How do you programmatically turn off the Windows XP Print Spooler service in C#
-
20-08-2019 - |
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!
Solution
You can probably do that using the ServiceController class :
ServiceController controller = new ServiceController("Spooler");
controller.Stop();
...
controller.Start();
OTHER TIPS
net start spooler
net stop spooler
http://www.tech-recipes.com/rx/864/windows-service-managing-through-command-line/
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