Installing Windows Services using NSSM
This post talks about how you can quickly and easily create Windows services with NSSM.
Creating Windows Services with NSSM
Windows includes a useful utility sc
which allows the creation of services however this can be complex to use.
NSSM aka the “Non-Sucking Service Manager” provides a small user interface to deal with Windows Services. Today I am going to show you how to install a simple Windows Service.
NSSM can be downloaded from their website: https://nssm.cc/download
Once unzipped it will have a folder for win64 and win32. If you are running a 64 bit windows install use the binary in win64. If unsure use the win64 binary and if it fails try the 32 bit binary. The majority of people will now be running a 64 bit windows install.
Once you know which folder to use you will want to open an adminstrative console or powershell window. To install a windows service you can enter the following.
nssm.exe install
Running this command will open up the NSSM install dialog.
This window will let you configure anything you need to related to the service. The key elements are:
- Path – Path to the executable that will act as the service
- Startup Directory – Directory that the executable will run in
- Arguments – Any arguments needed to be passed to the executable
- Service Name – Name of the service in Windows
Once entered pressing “Install service” will configure and install the service in Windows Service Manager.