I have a Windows service that runs on my local PC. My operating system is windows 7. I want to Start my service via C# code without going through "Computer Management > Services".
When I run the code below it gives me the following Exception
:
"Service {ServiceName} was not found on computer '.'."
ServiceController service = new ServiceController(serviceName);
try
{
TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds);
service.Start();
service.WaitForStatus(ServiceControllerStatus.Running, timeout);
}
catch
{
// ...
}
I've been through many posts regarding this scenario and all mention that this is a security feature of Windows 7
. Is there a way to run this service without middling the Admin Groups?