0

I have a host that runs several virtual machines, on every virtual machine runs a service wich works fine locally but when i try to execute it remote from the host i get accces denied. i have searched google for a while now, impersonate doesnt work because the host account is very different than the virtual machine accounts. i use the folowing code to start the remote service.

ServiceController sc = new ServiceController("ExecuterService", "servername");
sc.Start(id);

now my question is: is there a way to authenticate my C# app so it can start the remote service by for example just giving in the user credentials for that machine?

Kara
  • 6,115
  • 16
  • 50
  • 57
JackF
  • 63
  • 1
  • 9
  • possible duplicate of [How to remotely control a Windows Service with ServiceController?](http://stackoverflow.com/questions/2996282/how-to-remotely-control-a-windows-service-with-servicecontroller) or http://stackoverflow.com/questions/8581931/starting-remote-windows-services-with-servicecontroller-and-impersonation – Preet Sangha May 31 '13 at 10:06

1 Answers1

0

If the host application have correct access rights, then you could workaround and use process call to NET console comands:

ProcessStartInfo processInfo = new ProcessStartInfo("NET", "start ExecuterService");
Process process = Process.Start(processInfo);
p.WaitForExit();

But it is ugly.

ne2dmar
  • 504
  • 4
  • 17