• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 373
  • Last Modified:

Run as a service

I have a program that only starts when you login to the server.
How can I get a program to run as a service if it is not an option for that program?

Anyway to start the program when the server boots up with out login to the server to start it?

1 Solution
You can do that with srvany from the Resource Kit Tools, which is a service wrapper for other programs.
Windows Server 2003 Resource Kit Tools
How To Create a User-Defined Service

Another option would be to do that with a scheduled task that is scheduled to run at startup (only visible once the task is created), but the srvany makes it easier to manage.
acomispAuthor Commented:
does this apply to a windows 2003 server?
the artical goes up to server 2000.
Yes, srvany hasn't changed inbetween.
You'll find more documentation in the Resource Kit Help that is installed with the ResKit.
Note that you don't need to install the complete Resource Kit on the server (though I install it by default on every server, lots of useful tools), only srvany.exe and instsrv.exe are required. You can copy those from a machine on which the ResKit is installed.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Mohamed OsamaSenior IT ConsultantCommented:
SC.exe (service controller) can do it
CMD help output for SC Create command 
sc create /?
Creates a service entry in the registry and Service Database.
sc create [service name] [binPath= ] <option1> <option2>...
NOTE: The option name includes the equal sign.
 type= <own|share|interact|kernel|filesys|rec>
       (default = own)
 start= <boot|system|auto|demand|disabled>
       (default = demand)
 error= <normal|severe|critical|ignore>
       (default = normal)
 binPath= <BinaryPathName>
 group= <LoadOrderGroup>
 tag= <yes|no>
 depend= <Dependencies(separated by / (forward slash))>
 obj= <AccountName|ObjectName>
       (default = LocalSystem)
 DisplayName= <display name>
 password= <password>

"sc /create" will only create an entry in the SCM database, nothing more. You can only use it for programs that have been programmed to function as a service, you can NOT use it to run a normal program as a service.
I prefer to use RunAsSys

Despite its status, it is very useful and works fine, even on server and/or 64bit systems (up to Vista/2008).
It runs applications as the system user. I use it for Visual Studio and some other developer IDEs to test services without the service manager. (http://blog.delphi-jedi.net/2008/05/07/debugging-services-an-easy-way)

(Code is available for Delphi)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now