Hi I'm trying to change the startup type of a existing Windows service. Say "Spooler" ( Print Spooler). I'm using ServiceController
var service = new ServiceController("Spooler");
service.Start();
service.WaitForStatus(ServiceControllerStatus.Running, 600);
Though I'm able to start/stop services I'm not able to figure out how can I change the startup type itself? ( eg: Disabled/Automatic/Manual )
When I peek definition of ServiceController
I can see ServiceStartMode
being defined. Could someone help me how can I set this option?. My need is to disable a Windows service programmatically using ServiceControl class or any other feasible way..