NSSM - the Non-Sucking Service Manager
Quick links: Download - Description - Usage - Known bugs
nssm is a service helper which doesn't suck. srvany and other service helper programs suck because they don't handle failure of the application running as a service. If you use such a program you may see a service listed as started when in fact the application has died. nssm monitors the running service and will restart it if it dies. With nssm you know that if a service says it's running, it really is.
nssm logs its progress to the system Event Log so you can get some idea of why an application isn't behaving as it should.
nssm also features a graphical service installation and removal facility. Admittedly this does suck. I hate trying to make GUIs...
Download
nssm 2.0, (2006-09-09)
nssm 1.0, (2003-05-30)
Description
nssm functions very much like srvany. When started by the system service manager, it looks in the registry for the key HKLM\System\CurrentControlSet\Services\servicename\Parameters and tries to start the program listed in Application, starting in the directory listed in AppDirectory and passing the option flags listed in AppParameters. The observant reader will notice that these values are the same as those which srvany reads, which means that nssm can (almost) be used as a direct replacement.
For details on how nssm runs the service and handles application failure, see the source code included in the download and check the flmonitor documentation. nssm is basically an abstraction of flmonitor.
Usage
No "installation" of nssm is needed. Just place it somewhere on the system (preferably somewhere in your PATH) and run it.
Installing a service
You can use nssm to install a service. The command to type is:
nssm install <servicename>
You will be prompted to enter the path to the application you wish to run as a service and any commandline options to send to it.
The screenshot below shows installation of a UT2003 server. The command to run such a service is ucc server so the full path to UCC.exe is entered under Application and server is entered under Options.

Clicking Install service completes the installation of the service.
As of version 2.0 you can also bypass the GUI and install a service from the command line. The syntax is:
nssm install <servicename> <application> [<options>]
Please note that the actual program entered into the services database is nssm itself so you must not move or delete nssm.exe after installing a service. If you do wish to change the path to nssm.exe you can either remove and reinstall the service or edit HKLM\System\CurrentControlSet\Services\servicename\ImagePath to reflect the new location.
Removing a service
The command to remove a service is:
nssm remove <servicename>
A confirmation window is displayed before the service is removed.


As of version 2.0 you can also remove services from the command line viz:
nssm remove <servicename> confirm
nssm will happily try to remove any service, not just ones nssm itself manages. Try not to delete services you shouldn't...
Troubleshooting
nssm logs its activity to the system Event Log (under Application) so if you're having trouble with it, look in there for clues as to what's wrong!
Known bugs
Version 2.0: No known bugs.
Version 1.0: Writes incorrect AppParameter to registry if application name contains spaces.
Using nssm in place of srvany
If you are already using the combination of instsrv and srvany to run your service, nssm can almost be used as a drop-in replacement. Stop your service then edit the registry, changing HKLM\System\CurrentControlSet\Services\servicename\ImagePath to X:\path\to\nssm.exe run where X:\path\to is the place where you "installed" nssm. Don't forget to add run after the path! This is there so if you accidentally run nssm without and arguments it won't just sit there trying to interact with a non-existent service database...
