Run the process from a system account with a specific username

I am developing a Windows service in C#.net , Account: LocalSystem , System: Windows XP SP3
I want this service to check all registered users if the application is working, and if not, start this AS application with the corresponding username.

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

 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 the administrator group - the application starts successfully if it is started manually.

Is this done differently?

Thanks!

+4
source share
1 answer

How do you check running applications? In Windows Vista and newer, there is a separation between services and desktops. This may mean that you cannot access the necessary information, and the service is exploding for this reason. In the service dialog box, there is "allow interaction with the desktop" or a similar flag. You might want to try including this.

0
source

Source: https://habr.com/ru/post/1305839/


All Articles