Start process from System Account with a specific User Name

Posted by pavel.tuzov on Stack Overflow See other posts from Stack Overflow or by pavel.tuzov
Published on 2010-04-02T12:09:30Z Indexed on 2010/04/02 12:13 UTC
Read the original article Hit count: 235

Filed under:
|
|
|

Hi,

I'm developing a windows service in C# .net, Account: LocalSystem
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 accomplished in a different way?

Thank you!

© Stack Overflow or respective owner

Related posts about c#

Related posts about windows-services