make an application run as a service

This is how to make an application run as a service. This is for experienced Microsoft Windows people. Keep reading and see how this is done. Then, join the starting conversation for updating it. Also, I’ve linked a video for a current method to use. This is part of our Miscellaneous More Topics category.

Running a Program as an NT/2000 Service

Originally published in 2001, this is how to make an application run as a service. Some terminology references older file names; however, it conveys the steps performed on Windows Servers and Workstations. Some file names are possibly still used today on both Servers and Desktops. Leave comments and share any updated info for current times.

Overview of How To Make An Application Run as a Service

Running any program application run as a service would be great if that were always possible. However, it all depends on your home office technology you use. As an example, you might have a Windows App on your desktop you might want to keep running when you’re away from your home office setup. So, make it a service and schedule it to run. So, for a simple example, keep reading.

Example of How To Make A Phone App Run As A Service

A prime example would be if your small business uses a telephone and fax application on an NT Server or NT Workstation. Since typical software applications only startup when you’re logged in, you wouldn’t be able to ever log out. Because of this, it’s a challenge to your security of files and network. Also, others wouldn’t be able to have you log out so they can log in and use the computer. And, another issue is someone might accidentally close the software that needs to remain running. So, keep reading to see how to make this example application run as a service.

using laptop to make an application run as a service
Using laptop to make an application run as a service. Photo by Danny Meneses.

The solution, of course, is install it as an NT service so it runs hidden in the background when logged in and also so it won’t shut down when you log out. We reviewed instructions for the methods from two sources and found them to be extremely inadequate and technically incorrect so, we’ve written them in a step-by-step method that really works. These instructions were written and then followed step-by-step to ensure they’re very simple, specific, and correct for Windows NT Server 4. Also, quotes must be entered in where they are annotated by the example given.

Steps 1-4 Example To Make An Application Run As A Service

  1. Copy the file “srvany.exe” (available on an NT/2000 Resource Kit CD) anywhere on your boot drive. In this example, we created a folder called “Service” on the C drive.
  2. Copy the file “instsrv.exe” (available on an NT/2000 Resource Kit CD) in the Windows NT System32 folder. In this example it’s in “C:\WinNT\System32”.
  3. Think of a name that you want to appear in the Services list when you view Services. In this example, we’ll call it Phone Auto Attendant.
  4. Click on START, RUN. Then type the following into the OPEN text box and tap to run it: instsrv “Phone Auto Attendant” C:\Service\srvany.exe

Note: For Windows 2000, use a short acronym with no spaces, e.g., “PhoneAns”. After it’s added, change the Display name to be something more user-friendly, e.g., “Phone Auto Attendant”. This is located in the properties of the service under the “General” tab and looking at the item named “Display name”.

Steps 5-6 Example To Make An Application Run As A Service

  1. For a brief moment the screen will darken and then reappear. You can go into the Control Panel, and open the “Services” area to look for your new service named “Phone Auto Attendant”. If it appears, you have done very well and can continue.
  2. If you make a mistake in naming or if you want to eliminate your new service, you can delete a service by copying the file Delsrv.exe (available on an NT Resource Kit CD) to the Windows NT System32 folder. Then click on START, RUN. Then type the following into the OPEN text box and tap to run it: delsrv “Phone Auto Attendant”

Note: For Windows 2000, this won’t work. So, replace the long name in quotes (i.e., the Display name). Use a short name. That’s found in the service properties, under the “General” tab. From there, see the item named “Service name”.

Final Steps Example To Make An Application Run As A Service

  1. You must now identify this new named service with an application. In this example, your program is located at “c:\Programs\MyProgram.exe”. Note the spelling of this next file (regedt32) to execute. Run “regedt32”; (NOT “regedit”) from the command line and various registry windows will appear. To specify an application to start as a service go to the window named HKEY_LOCAL_MACHINE. Drill down into System\CurrentControlSet\Services. Select the folder name of your new service “Phone Auto Attendant” in the left Window pane. Click on menu item EDIT and then select “Add Key”. Type in the value: parameters

Then, leave the entry “Class” empty, if available. Tap to continue. The folder named ‘parameters’ is created. Select this new folder and click on menu item EDIT and select “Add Value”. Type the following value entry (use a data type selection of REG_SZ): Application

Then tap to run it. After that, a dialog box prompting for a string value will appear. Enter in the path of the application file to run as your service. Our example string entry would be: C:\Program Files\HotFax MessageCenter\HFMC.exe

Then tap to run it.

Testing Steps Example To Make An Application Run As A Service

  1. You’ll be able to go into the Control Panel, locate your service, and click on the button to start up the service. If you get an error, you should go back and check your work. If you need to correct your incorrect value in the registry, run regedt32 again and select the incorrect line to remove, click the key, answer the prompt ; then re-enter it correctly. Or, you can double-click the entry and edit it. Most errors here are due to adding or not adding a space within a folder name of the program’s complete path. If you still have a problem and you suspect it’s the path, create a shortcut of the program onto your Desktop; use the properties of that new shortcut to copy the precise path.
  2. After entering the registry entry, reboot the machine. The service should start after rebooting. It will start hidden from your view unless you check the “Interact with Desktop” selection box. A word of caution: If using the application on the desktop, don’t “Close” the application before you logout. That’s because, in this example, closing the app will also end the service. So, a good practice is to just reboot the system as a method of you logging out. That way the service will restart along with the system.
  3. Also, some applications will require admin privileges to have full functionality; this means “System Account” is not enough. It is best to run various scenarios to get familiar with the differing possibilities.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *