none
Application as a Service "srvany.exe" in Windows Server 2008

    Question

  • Hi,

    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
    Monday, August 18, 2008 10:28 AM

Answers

All replies

  •  

    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.

     

     

    Tuesday, August 19, 2008 10:04 AM
    Moderator
  • 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 ...

    1. 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\ ).
    2. 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" )
    3. Using RegEdit : create a "Parameters " key for your service (e.g. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\Paramaters\ )
    4. 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
    Wednesday, September 23, 2009 3:05 AM
  • Brilliant.  Thanks!
    Sunday, September 27, 2009 1:17 AM
  • thanks a mill. works perfectly.
    Perth, Western Australia.... mate :)
    Thursday, May 06, 2010 7:05 AM
  • your awesome, worked perfectly.
    Friday, May 14, 2010 3:02 AM
  • Brilliant, worked perfectly. Thank you.


    pinesh
    Friday, July 09, 2010 3:59 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!

    Wednesday, July 14, 2010 10:38 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 ...

    1. 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\ ).
    2. 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" )
    3. Using RegEdit : create a "Parameters " key for your service (e.g. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\Paramaters\ )
    4. 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!!!

    Friday, September 24, 2010 10:15 AM
  • 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 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


    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

     

    Monday, January 03, 2011 7:43 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

    Wednesday, January 19, 2011 9:39 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".

    Friday, January 28, 2011 11:20 PM
  • This works under 2008 R2 as well! Good work people!
    Thursday, February 24, 2011 1:48 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 ...

    1. 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\ ).
    2. 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" )
    3. Using RegEdit : create a "Parameters " key for your service (e.g. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\Paramaters\ )
    4. 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??

    Sunday, April 24, 2011 5:31 PM
  • Tanks Graeme your trick works for me today..:)

    Virgo

    Thursday, June 07, 2012 5:53 AM
  • 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

    1. so in "Application" I put the full path to cscript.exe
    2. 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, February 13, 2013 4:31 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.

    Wednesday, March 20, 2013 7:12 PM
  • To answer your questions:

    1. Does the executable have to reside in the Windows System32 path?

    Srvany.exe will run from the System32 path, so that will be your application's working directory. If your application pulls in DLLs or other resources from its installation folder, then you will need to place those in System32 or better, add that folder to the PATH.

    2. Is this the only way to add a new service?

    No! As you have noticed, Srvany.exe has a few shortcomings so we offer a commercial solution (called AlwaysUp) with a free 30-day trial. There are others as well.


    • Edited by Core Tech Sunday, November 03, 2013 4:20 PM mis-spellings
    Sunday, November 03, 2013 4:18 PM