I have personally come accross quite a few senarios where I require an application to be run as a service on a server. One of the these senarios was to implement a web print solution. The idea was to have Google Chrome Browser run on a server whilst no one was logged in to the server therefore requiring it to be run as a service, Google Chrome would be signed into a Google account which had a printer attached and the printer shared out to all other users. Then from a mobile device you would be able to print utilising the Google Cloud Print solution.
A server (running 2003 or 2008)
Google Chrome installed – signed in to a google acocount with printer attached
Windows Server 2003 Resource Kit Tools – Need to download for Server 2008
The solution was to use srvany.exe from within the Windows Server 2003 Resource Kit. This was fairly simple and can be used to run any application as a service.
- If you are using Server 2008 you will need to download the “Windows Server 2003 Resource Kit Tools ” and copy the srvany.exe to a suitable location on your Windows 2008 server (e.g. C:\Windows\System32\ ).
- Use “sc ” to create a new service that launches “srvany ”
sc create MyService binPath= C:\Windows\System32\srvany.exe DisplayName= “My Custom Service” )
- Using RegEdit : create a “Parameters ” key for your service (e.g. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\Paramaters\ )
- Using RegEdit : within the newly created “Parameters ” key , create a string value called “Application ” and enter the full path to the application you are wanting to run as a service. (No quotes required.)