Application as a Service "srvany.exe" in Windows Server 2008
-
Monday, August 18, 2008 10:28 AMHi,
I would like to migrate an application hosted on a Windows 2003 R2 Server that use the "srvany.exe" in order to run as a service.
I can't find any resource pointing out the way to do this in 2008.
Any idea ?
Thanks for the help.
Regards,
Adrien Pestel
All Replies
-
Tuesday, August 19, 2008 10:04 AMModerator
Hi,
Based on my research, there is no formal version of srvany.exe that supports Windows server 2008. However, for more further assistance on this issue, I'd suggest you post to our MSDN queue:
MSDN Public newsgroup
http://msdn.microsoft.com/newsgroups/default.asp
MSDN Forum:
http://forums.microsoft.com/msdn
The engineers there are more specialized in programming and application and may share their valuable suggestion with you.
- Marked As Answer by Morgan Che [MSFT]Moderator Friday, August 22, 2008 1:33 AM
-
Wednesday, September 23, 2009 3:05 AM
I, too, am wanting to use a "svrany" situation on Windows Server 2008, but couldn't find anything much more useful than this thread! (Yes, that is pathetic!) ... other than some references (etc.) to "sc". So after much banging of my head against a wall with "sc", I decided to experiment , and ... SUCCESS!!!
Here's what to do ...
- At the time of this posting, there is no Windows Server 2008 Resource Kit Tools, so get the "srvany.exe " from the "Windows Server 2003 Resource Kit Tools " and copy it to a suitable location on your Win2008 server (e.g. C:\Windows\System32\ ).
- Use "sc " to create a new service that launches "srvany " (e.g. 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.)
And that should do it.
Note : some applications store their settings in a user hive, not under HKEY_LOCAL_MACHINE, so you will need to run the application to configure it, and then configure the service to run as that user.
Enjoy!- Proposed As Answer by Graeme.N Wednesday, September 23, 2009 3:05 AM
-
Sunday, September 27, 2009 1:17 AMBrilliant. Thanks!
-
Thursday, May 06, 2010 7:05 AMthanks a mill. works perfectly.
Perth, Western Australia.... mate :) -
Friday, May 14, 2010 3:02 AMyour awesome, worked perfectly.
-
Friday, July 09, 2010 3:59 PM
Brilliant, worked perfectly. Thank you.
pinesh -
Wednesday, July 14, 2010 10:38 PM
Awesome! This works with the WHSv2 VAIL Preview as well - confirmed, set up utorrent and its working fine with another user account I created, first try lucky me!
-
Friday, September 24, 2010 10:15 AM
I, too, am wanting to use a "svrany" situation on Windows Server 2008, but couldn't find anything much more useful than this thread! (Yes, that is pathetic!) ... other than some references (etc.) to "sc". So after much banging of my head against a wall with "sc", I decided to experiment , and ... SUCCESS!!!
Here's what to do ...
- At the time of this posting, there is no Windows Server 2008 Resource Kit Tools, so get the "srvany.exe " from the "Windows Server 2003 Resource Kit Tools " and copy it to a suitable location on your Win2008 server (e.g. C:\Windows\System32\ ).
- Use "sc " to create a new service that launches "srvany " (e.g. 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.)
And that should do it.
Note : some applications store their settings in a user hive, not under HKEY_LOCAL_MACHINE, so you will need to run the application to configure it, and then configure the service to run as that user.
Enjoy!Hello!
My experience on Win2008 64bit to install Windows Server 2003 Resource Kit Tools had been the following.
I copied srvany.exe to c:\windows\system32 but step 2 didn't work yet.
So I tryed simply usigne the Resource Kit Tools command instsrv.exe and it works fine!!!
-
Monday, January 03, 2011 6:45 PM
Hi,
I followed these steps in Win 2008 and I everything works fine except the stopping part. The service won't stop. It shows stopped in the Services dialog but it is actually still running.
How can I set it up to actually stop?
Thanks
-
Monday, January 03, 2011 7:43 PM
Hi,
I followed these steps in Win 2008 and I everything works fine except the stopping part. The service won't stop. It shows stopped in the Services dialog but it is actually still running.
How can I set it up to actually stop?
Thanks
Also, on Windows 2000 I see it a process in the process list in the Task Manager, but with 2008 I don't have my process listed so I cannot manually kill it. Any idea how at least make it appear in the process list? It is a java program run from a .bat file.Either stopping it or show it in the Task Manager would work, as I can kill it manually if doesn't stop automatically.
Thanks
-
Wednesday, January 19, 2011 9:39 PM
Don't run it from a bat file.
Running it from a bat file will spawn a new process, that srvany doesn't "see" anymore and that is why it can't stop your java proces; it can only stop running the "bat"-proces.
rgrds
-
Friday, January 28, 2011 11:20 PM
For runnig a bat file at computer start You can use "windows scheduler".
Start->Control Pannel->Scheduled Tasks->Add scheduled task
In wizard you can check the option "When my computer starts".
So the task will start as the computer starts without need to sign on - like any "windows service".
-
Thursday, February 24, 2011 1:48 AMThis works under 2008 R2 as well! Good work people!
-
Sunday, April 24, 2011 5:31 PM
I, too, am wanting to use a "svrany" situation on Windows Server 2008, but couldn't find anything much more useful than this thread! (Yes, that is pathetic!) ... other than some references (etc.) to "sc". So after much banging of my head against a wall with "sc", I decided to experiment , and ... SUCCESS!!!
Here's what to do ...
- At the time of this posting, there is no Windows Server 2008 Resource Kit Tools, so get the "srvany.exe " from the "Windows Server 2003 Resource Kit Tools " and copy it to a suitable location on your Win2008 server (e.g. C:\Windows\System32\ ).
- Use "sc " to create a new service that launches "srvany " (e.g. 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.)
And that should do it.
Note : some applications store their settings in a user hive, not under HKEY_LOCAL_MACHINE, so you will need to run the application to configure it, and then configure the service to run as that user.
Enjoy!Ok so I got the srvany.exe to start and all but the parameters stuff is not working because the application is not running. I don't understand the Note you've given either and if ti really applies to me.
Any ideas??
-
Thursday, June 07, 2012 5:53 AMTanks Graeme your trick works for me today..:)
Virgo
-
Wednesday, February 13, 2013 4:31 PM
Brilliant.
One extra thing: If your application requires switches, create a a string value called "AppParameters" in the same location as "Application".
In there you can add your switches. In my case I was running a vbscript
- so in "Application" I put the full path to cscript.exe
- in "AppParameters" I put my switches like /b /nologo "path\to\script.vbs" /other /switches
Thanks again for sharing.
- Proposed As Answer by JuliusPIV Tuesday, February 19, 2013 3:11 PM
-
Wednesday, March 20, 2013 7:12 PM
We are using a new Payroll program and there is an executable that needs to be running at all times on Windows Server 2008 R2. I have a couple of questions.
1. Does the executable have to reside in the Windows System32 path? Ours is in C:\Program Files (x86)\pname\timeclockmgr\dcm\exename.exe.
2. Is this the only way to add a new service? It seems rather dangerous without more specific instructions.
I'd appreciate any feedback on this as we are currently preparing to go live and we already require this service running 24/7 under the local admin login.

