Running applications as a service on Windows 2008 or SBS 2008

Recently I was presented a challenge of making an application run as a service. That part is usually not to hard, we can use the free Windows NT Resource Kit utilities and SRVANY.EXE to accomplish this. Many great how to’s have been written on this, and I will include links at the end to some of these great articles. But what happens when SRVANY.EXE doesn’t allow the program to run correctly?

Doing a little research, I came across this little freeware application that helped out. It’s called Winserv and is free and open source. To get the tool, visit . Once downloaded, I used the command line Winserv install MyServiceName PathToExecutable . That seemed to work as far as getting the application to load, but in my case, the remote programs that connected to this application still did not work. I got out RegMon by Mark Russinovich to see if I could trace why it was not working. Upon running this tool, I noticed that when the application ran via Winserv it was looking for a registry key that simply didn’t exist.

Doing a little more digging, I decided to run the application with Interactive Mode enabled. (Inside the services.msc for my new service called MyServiceName is “Allow service to interact with desktop”). So checked this box, then re-ran the service. This time, Windows prompted me to see the interactive application. I clicked on it and selected it, and the actual application I was running via the service was prompting me for information. This turned out to be the registry keys that RegMon indicated to me. I filled out the requirements the application wanted, and then closed the app. This time I turned off Interactive Mode and re-ran the service. I then tested my clients application and it worked as expected.

As I couldn’t leave good enough alone, I decided to remove WinServ and use the built in SRVANY.EXE application doing the same steps with Interactive Login. It didn’t work. So I reverted back to WinServ and the application worked as expected, even on a x64 server.


4 comments to Running applications as a service on Windows 2008 or SBS 2008

  • This is just a brilliant tool.

    Can you please provide me an example of command line of how can i install a windows service EXE in a path like : “D:\MyFolder\MyTool.exe” ?

  • Whenever i try to give anything like : winserv install “MyService”, its throwing a message as: ‘ERROR 5 : ACCESS DENIED’ Do you have an idea why its so ?

  • I am using Windows server 2008 OS. Hope winserv supports without any issues this tool.

  • Hi Lyle. I’m not sure how WinServ works, but Session 0 Isolation introduced in Windows Vista (and present in all versions of 7 and 2008) prevent Srvany-created Windows Services from showing up on your desktop. Services are now run in an isolated desktop (on Session 0) and their GUI elements won’t mingle with your regular windows applications. Microsoft made the changes to improve security, but it can be rather inconvenient at times!

    Our company has developed AlwaysUp, a commercial alternative to Srvany that can run any application as a Windows Service. It can often get around the limitations of Session 0 Isolation and make your Windows Service visible. You can try it free for 30 days to see if its worth the cash…

    And you may want to review our page comparing Srvany and AlwaysUp to see why we believe AlwaysUp superior.

    Keep writing!