Running a Program as an NT Service

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
Running a Program as an NT Service Copyright ? 1999 by Jeff Baygents.
All rights reserved.
Requests for reprint or distribution may be via e-mail to Jeff@Baygents.com
Running any program application as a service would be great if that were always possible. Well, in many cases, that might be a possibility!
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. In that case it’s a compromise 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. The solution, of course, is install it as an NT service so that it runs hidden in the background when logged in and 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 NT Server 4. Quotes must be entered in where they are annotated by the example given.
Copy the file Srvany.exe (available on an NT Resource Kit CD) anywhere on your boot drive. In this example, we created a folder called "Service" on the C drive.
Copy the file Instsrv.exe (available on an NT Resource Kit CD) in the Windows NT System32 folder. In this example it’s in "C:".
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.
Click on START, RUN. Then type the following into the OPEN text box and click :
instsrv "Phone Auto Attendant" C:.exe
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.
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 click :
delsrv "Phone Auto Attendant"
You must now identify this new named service with an application. In this example, your program is located at "c:.exe". Run "regedt32" 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 on Local Machine". Drill down into System. You will see a folder with the name of your new service "Phone Auto Attendant"; select it. Then, at the RegEdt32 main menu area, click on menu item EDIT and the select "Add Key". Type in the following value:
parameters
Leave the entry "Class" empty. Click . The folder named 'parameters' is created. Select this new folder and click on menu item EDIT and select "Add Value". Type in the following value entry (use a data type selection of REG_SZ):
Application
Then click on . Then, a dialog box prompting for a string value will appear. Enter in the path (no quotes) of the application file to run as your service. Our example string entry would be:
C:FilesMessageCenter.exe
Then click on .
Tip: To get an accurate path string reading, copy a shortcut of the application to your desktop first, right-click to select its properties, and copy its shortcut path from there. Paste it into the string entry box (remove the quotes before clicking on ).
If you've performed the above steps correctly, 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.
After the registry entry has been entered in, 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 you choose to have the application interact with the desktop, note that if you are logged in and you close the application, and then you log out, there is no service running. It is best to run various scenarios to get familiar with the differing possibilities.
 
 

Similar threads

A
回复
0
查看
932
Andreas Hausladen
A
A
回复
0
查看
981
Andreas Hausladen
A
A
回复
0
查看
399
Andreas Hausladen
A
A
回复
0
查看
805
Andreas Hausladen
A
A
回复
0
查看
607
Andreas Hausladen
A
后退
顶部