Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top