The following solution requires editing of the Windows Registry. Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. You should always back up the Registry before editing it.
The Windows Server 2003 Resource Kit Tools
are required for creating a user-defined service -- download them and follow the standard installation process.
Once the kit is installed, follow the steps below (they can also be found in more detail at How to Create a User-Defined Service
- From the command prompt, call the instsrv utility providing two parameters: service name and srvany.exe file path, as follows:
- instsrv "My Service" "%Resource Kit%\Tools\srvany.exe", where My Service is the name of the service you are creating, and the path %Resource Kit% is the fully-qualified path to the Windows Resource Kit.
- The default location of the Windows Resource Kit is typically C:\Program Files\Windows Resource Kit.
- Open the Registry and locate the following subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%My Service%
- Create a new Key named Parameters.
- Create the following new Value within the Parameters key:
- Value Name: Application
- Data Type: REG_SZ
- String: %Application Path%, where %Application Path% is the fully qualified path to the application executable including the extension.
- Close the Registry.
The Windows Server 2003 Resource Kit Tools provide two utilities that allow you to create a user-defined service for Windows applications. One is instrsrv.exe, which installs and removes system services from Windows, and the other is srvany.exe, which allows any Windows application to run as a service.
By default, a newly created service is configured to run automatically when the system is restarted. Also, services do not have user interfaces, so your application must run without direct interaction on the front panel. You can still control the applications using methods like VI Server or network communication. Install Application as Windows Service
is an example that will automate this process for you.