Question

I need to write a small console app (patch) that turns off the print spooler service, does a few things, then starts the print spooler service. I'd like to write this in C#. Can someone point me in the right direction? Thanks in advance!

Was it helpful?

Solution

You can probably do that using the ServiceController class :

ServiceController controller = new ServiceController("Spooler");
controller.Stop();
...
controller.Start();

OTHER TIPS

I suspect you use the ServiceController class to control (i.e. to stop and start) the service whose name is spooler.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top