views:

280

answers:

1

Hi,

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 accomplished in a different way?

Thank you!

A: 

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.

BrianLy
I'm checking it with Process[] pname = Process.GetProcessesByName(_procName); It does work. Moreover, I can Start the process as "SYSTEM" user. And, yes, that check box is enabled.
paschka76