2010-03-10

Running Windows Services on Demand

If you happen to take a look at the Task Manager of a common Windows box you'll see tons of crap running, even before any useful programs are started.  Malware aside, what the hell is all this junk?

Well the answer is different in each case, but on the whole, Windows developers have turned into spammers.  They install utilities and icons to keep your attention and load their bloated services and libraries in an attempt to appear speedy, at the expense of your machine and other software.  The logical conclusion of this IT arms race is collateral damage, performance sapping cruft, and visual clutter.

The Problem


Using a Ludacris amount of resources.
Two big offenders in the area of installing performance sapping services are Apple's iTunes and VMWare Workstation.  Most geeks are quite familiar with these applications.  While not standouts in the areas of obnoxious icons and sleazy business practices such as from the likes of Real Player; Big, bloated, and beefy, are accurate terms to describe their resource usage.

It wouldn't be quite so bad if it all went away on exit like Firefox, but would you believe these products install multiple services each that run constantly, using resources whether you are using the associated programs or not?  It gets worse—if you set them to start up manually the software won't even try to load them on demand, though Windows provides that functionality. What a pain.

These are useful applications, however, hence the problem.  How can we corral them into more responsible behavior?  I'll now explain a technique to solve this and return "teh snappy" back to your boxes, when running these or similar software.


Four extra services running makes for bad Karma.

A Solution

  1. First, hunt down the offenders.
    1. Check the Task Manager and Services Management Console application, "services.msc", which can be run from command-line, the run box, or Admin Tools from the Start Menu/Admin Tools.
    2.  Look for the Vendor's name to help narrow the search.  Google the names of unknown processes if not sure.
  2. Set the startup type of the services found to Manual.
    Open properties for each service to configure the Startup type.
  3. Next, try running the application, to see what it complains about to get an idea which services are required.
  4. With that info in mind we now write a command script (.cmd, aka "Batch File") that does the following:
    1. Starts the necessary services.
    2. Waits a sec,
    3. Runs the program and waits until user is finished.
    4. Stops the services.
  5. Next, save this script to the Application's Program Group/Folder in the Start Menu or preferred location. 
  6. Finally, create a shortcut pointing to the script.  This allows us to set the following options:
    1. Make sure to select, "Run: Minimized" or you'll see an ugly "DOS" box come up every time you run it.
    2. Choose a nice icon if you'd like then hit the Apply and OK buttons to save it.
    3. From the folder in the Start Menu, drag the icon of the new shortcut to the top of the list so it is easiest to get to. 
The one drawback to this is that you'll get one extra icon in your taskbar when using the application, but I think it's a small price to pay to keep all this junk from running constantly.  Luckily I've gone ahead and done the hard work for you, see the samples below:

VMWare Example Script:  run_vmw_svcs.cmd

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
@echo off

sc start VMAuthdService
sc start VMnetDHCP
sc start "VMware NAT Service"
sc start vmount2

rem Ping trick to wait a second ...
ping -n 3 "127.0.0.1" > nul
start /w "vmware" "C:\Program Files\VMware\VMware Workstation\vmware.exe"

sc stop VMAuthdService
sc stop VMnetDHCP
sc stop "VMware NAT Service"
sc stop vmount2

iTunes Example Script:  run_itunes_svcs.cmd

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
@echo off

sc start "iPod Service"
sc start "Apple Mobile Device"

rem Ping trick to wait a second ...
ping -n 3 "127.0.0.1" > nul
start /w "iTunes" "C:\Program Files\iTunes\iTunes.exe"

sc stop "iPod Service"
sc stop "Apple Mobile Device"

For iTunes, make sure to also remove iTunesHelper.exe, qttask.exe, and the Bonjour service (I didn't install it) from your startup programs for the full effect.  I'll be discussing that common technique in a future article.

With these techniques I now have six less services and three less startup programs, for a total of nine! fewer processes running constantly on my machine.  It makes a big difference the 80% of the time I'm not using these programs.  I hope this helps a few geeks out there.  What other ideas do you have to speed up lethargic Windows boxes?


No comments:

Post a Comment