Windows Server 2003: House keeping Services

Doing a bit of housekeeping this morning. One of my irregular tasks is to run through the server event logs and deal with any issues (with a strong cup of coffee).

Not many this morning fortunately.

One related to a service entry left behind after an uninstall (used to share this server with a bunch of C# developers who loved all sorts of 3rd party apps).

The one in question was CruiseControl. The app had been removed OK but have left behind a service entry that failed as the app was no longer there.

So - To delete an orphaned (or any!) service.

There are two methods

  1. Run the Sc command

  sc query state= all | findstr "SERVICE_NAME"

to locate the service name and then run sc delete service_name


   sc <server> delete [service name]

where service_name is the service as listed in the previous command. I prefer this method since it cleanly removes the service respecting if it is running etc.

So in this case

sc delete cruisecontrol  - giving [SC] DeleteService SUCCESS
       

[F5] in the registry and the services listing will show the service entry to be gone! Without a need to reboot. If the service you deleted was running or actually existed - a reboot would be a good idea.

2) The second method is to remove from the registry by hand

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

So in this case

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CruiseControl

All usual warnings apply (backup your registry, etc).

Note that previous 'good' reg versions of controls sets are stored too in

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002

These will be updated once you have rebooted and all is OK.

ControlSet001 may be the last control set you booted with, while ControlSet002 could be what is known as the last known good control set, or the control set that last successfully booted.

I say could...

See http://support.microsoft.com/?kbid=100010