开发者

Start process from System Account with a specific User Name

开发者 https://www.devze.com 2022-12-25 17:19 出处:网络
I\'m developing a windows service in C#.net, Account: LocalSystem, System: Windows XP SP3 I want this service to check for all currently logged users if a specific application is running and if not -

I'm developing a windows service in C#.net, Account: LocalSystem, System: Windows XP SP3

I want this service to check for all currently logged users if a specific application is running and if not - start this application AS corresponding user name.

I provide domain, name, password, but Start() throws Win32Exception exception "Access is denied"

process.StartInfo.Domain = domain;  
process.StartInfo.UserName = name;  
process.StartInfo.Password = password;  
process.StartInfo.FileName = fileName;  
process.StartInfo.UseShellExecute = false;  
process.Start();  

The user whose credentials I provide is in administrator group - the application successfully runs if started manually.

Is this accompli开发者_运维问答shed in a different way?

Thank you!


How are you checking for applications which are running? In Windows Vista and newer, there is separation between the services and desktops. This may mean that you cannot access the desired information and the service is bombing out for that reason. There is an 'allow interaction with desktop' or similar check box in the service dialog. You might want to try enabling that.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号