Automatic Shutdown and Startup of Services

My poor workstation has to put up with some unusual requirements for flexibility.  Much of the time, it's a simple personal workstation on which I write documents, compile spreadsheets, and answer email.  At other times, I need it to behave like a high-end database server, or, at least manage to be as high-end as it can go.  And in yet another set of situations, I need to push it to the utter limits of its capabilities while performing database benchmarks and tests.

One of the things that I've found is that I can make my life a lot easier when switching from one workload to the other by dynamically enabling and disabling various Windows services that are running on the workstation.  For example, I hardly need all of those services that Apple's iTunes require while I'm running a TPC benchmark overnight, but I really enjoy iTunes while I'm clicking away at the keyboard.  My answer to this problem (and there are many other ways to do it, such as PowerShell) is to use CMD files to start and stop services as I need them.  The CMD files can make use of two key utilities: SC.exe or NET.exe.  (Read more about SC.exe here and NET.exe here).

For example, you might add a number of lines to shutdown various Windows services using the syntax of either command, as in:
SC STOP "iPod Service"
NET STOP "Apple Mobile Device"
You could similarly write a CMD file to start the same Windows services by substituting the STOP keyword with the START keyword.  It don't get much easier than that!

I spent a few minutes parsing through my list of running services and, once I'd established all of the "user comfort" services, created the CMD file to shut them all down.  I then created a second version of the file that started the same services, in case I wanted to switch from benchmarking mode to user mode.  (Those are my terms, not industry standard terms).

What other techniques have you used to automate processes like these?  I'd like to hear about your approach to enabling and disabling services as needed.


-Twitter @kekline
-More content at

Discuss this Blog Entry 1

on Apr 28, 2010
Hi Kevin,

I like PsService by Mark, it is easy to handle.


Please or Register to post comments.

What's Tool Time Blog?

SQL Server tools and tips from Kevin Kline.

Blog Archive

Sponsored Introduction Continue on to (or wait seconds) ×