Вопрос

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?

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top