Installing Perl Programs as a Service with Windows NT4.0, 2000, XP, 2003

bewgrosseteteSoftware and s/w Development

Dec 13, 2013 (3 years and 10 months ago)

76 views



Installing
Perl P
rograms as a Service
with


Windows NT4.0, 2000, XP, 2003


This is to document the process of creating Wind
ows services using

Perl programs. The
same procedure should work for other scripting languages on Windows with some small
changes.

Not all languages are supported so try if you want.


Step 1 :

Acquire the two program files you will need to create a service

with (
instsrv.exe
,
srvany.exe
) and place them on the computer you want to create the service on
.
These can be picked up from the
M
icrosoft Windows NT Server 4.0 Resource Ki
t.

You can also find these at Microsoft’s web site with a little looking.

I usually place these files in the C:
\
bin folder, because that’s where I place all the
custom stuff.

My examples will be based on this locat
ion

and the DbMove
program I created
.


Step 2 :


From the Command Prompt or Run dialog box, execute the command

c:
\
bin
\
instsrv
service name

c:
\
bin
\
srvany.exe


For instance, to set up the DbMove service on the SQL server, I used:



c:
\
bin
\
instsrv DbMove c:
\
bin
\
srvany.exe

The service name is just a user friendly name so you can name it anything useful.


Step 3 :


The third step is tricky and dangerous. It is editing the registry.

Disclaimer: If you are

not familiar with editing the R
egistry or have the bad
luck to
regularly break things… don’t do this step. Get some help. Damage to the Registry

can render the computer a power using door stop with no easy way to repair
(~2days work for recovery w/o backups… Old backups do not count).


Now then: From a Comman
d Prompt or Run dialog box, type “
regedit”
.

B
rowse to the entry
HKEY_LOCAL_MACHINE
\
SYSTEM
\
CurrentControlSet
\
Services
\
DbMove


C
reate a new key here, and name it "
Parameters
"; it should appear as a new
"fol
der" inside the
DbMove

entry.

Create a new value in
the "Parameters" folder, and name it "
Application
".

Modify the data of the new "Application" value, setting it to be the full path to the
Perl executable; normally this is
c:
\
perl
\
bin
\
perl.exe


Create another new value in the "Parameters" folder, and name

it
"
AppParameters
"

Modify the data of the "AppParameters" value to be the full path to the
DbMove

script; e.g. something like
C:
\
bin
\
dbmove.pl


Exit
regedit

by just closing the program.


Step 4 :

Determine the account that you want the service to run un
der, If it will need
network access you will need to select an account but if not, using the
LocalSystem account is the safest way.


Step 5 :


Start the Service:

O
pen the Services Control Panel, (under "Administrative Tools" on XP), and
open the Properties

win
dow for the new
DbMove

service. Set the Startup type to
"Automatic", so the service will start every time the system is rebooted. Then,
click "Start" to start it.



Last but not least, for more information, here are some links to articles on how to do
this.


http://www.winnetmag.com/Articles/Index.cfm?ArticleID=7959

http://www.winnetmag.com/Article/Article
ID/8148/8148.html

http://www.foo.be/docs/tpj/issues/vol4_3/tpj0403
-
0011.html