I want to restart the "SAVService" (Sophos Antivirus) windows service using the ServiceController class in C#.
-- I added a reference to the ServiceProcess.dll in my C# project
-- I defined the service like this:
myService.ServiceName = "SAVService";
--I can get the status of the service like this
string svcStatus = myService.Status.ToString(); //This works - Shows SAVService is "Runing"
When I try to stop the SAVService like this: myService.Stop();
I get an Exception "Cannot open SAVService on the computer" I suspect this may be a security issue. The SAVService on my computer will only start/stop using the Login "Local System" or Login/pswd "Local Service\Sophos default password"
Does anyone know how to define the User/Password for a windows service in ServiceController ?