Professional Documents
Culture Documents
There are lots of great utilities out there which do essential tasks such as monitoring and reporting that once you have
configured them, they just sit in your system tray and do their job without you ever knowing. While this works great
for desktop machines, this model is not ideal for server use which, typically, does not have anyone actively logged into
it.
The solution is to run the application as a Windows Service which runs in the background regardless of whether or not
a user is logged in. This article will show you how to run any application as a background service using the free tool,
SrvStart.
SrvStart Overview
Simply put, SrvStart allows you to run any application as a Windows Service. While the vast majority of applications are
not suited for this type of deployment (i.e. Notepad, Microsoft Word, etc.), there are lots of utilities which can run
seamlessly as a background service. By interfacing with the Windows Service Manager, SrvStart interprets the
Operating System commands, such as start (open) and stop (close), and sends them to the target application which
doesnt know the difference.
Much like the Microsoft tool, SrvAny, SrvStart was developed for Windows NT but still works on the newest operating
systems (we are using Server 2008 for our walkthrough). The different between Microsofts SrvAny and SrvStart is that
SrvStart is much more configurable. For example, stopping a service controlled by SrvAny is essentially the same as
killing (think Ctrl+Alt+Del) the respective application where SrvStart can send a close message to the application so it
can shut down gracefully.
So with the application configuration completed, we use the built in Windows SC command to add a new Windows
Service. Run the following from the command prompt (note there is a space after each equal sign, this is required):
SC CREATE Belvedere DisplayName= Belvedere binPath=
srvstart.exe Belvedere -c C:BelvedereService.ini start=
auto
SC DESCRIPTION Belvedere Automated file manager.
With the service created, it will now appear in the Windows Services list and can be configured like any other Windows
Service. Before starting the service, close Belvedere if you have it open.
Thats it. If you check your Task Manager, you will both Belvedere.exe and srvstart.exe running.
Important Notes
One thing to keep in mind is that when the application is running as a service, it has no interface. This means you
cannot see or respond to message boxes and prompts raised by the program. Additionally, you cannot make
configuration changes on the fly. When you need to make changes, you have to do the following:
1. Stop the service the application is running as.
And when running as a service, you will see no tray icon even though it is running in the background.
Conclusion
While we have demonstrated turning an application into a service with a file monitoring utility, this same procedure can
be applied to anything from hardware monitors to report generators. Be creative as this has lots of uses.
As mentioned previously, we are using SrvStart with only the most basic configuration. Although this is probably all
you need the majority of the time, it is good to keep in mind that SrvStart has many other settings you can use to fine
tune how the program runs in service mode.
Links
Download SrvStart by Nick Rozanski
Download Belvedere from Lifehacker
Jason Faulkner is a developer and IT professional who never has a hot cup of
coffee far away. Interact with him on Google+
Published 07/15/10