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

    Întrebare

  • 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
    18 august 2008 10:28

Răspunsuri

Toate mesajele

  •  

    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.

     

     

    19 august 2008 10:04
    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!
    • Propus ca răspuns de Graeme.N 23 septembrie 2009 03:05
    23 septembrie 2009 03:05
  • Brilliant.  Thanks!
    27 septembrie 2009 01:17
  • thanks a mill. works perfectly.
    Perth, Western Australia.... mate :)
    6 mai 2010 07:05
  • your awesome, worked perfectly.
    14 mai 2010 03:02
  • Brilliant, worked perfectly. Thank you.


    pinesh
    9 iulie 2010 15:59
  • 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!

    14 iulie 2010 22:38
  • 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!!!

    24 septembrie 2010 10:15
  • 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

    3 ianuarie 2011 18:45
  • 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

     

    3 ianuarie 2011 19:43
  • 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

    19 ianuarie 2011 21:39
  • 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".

    28 ianuarie 2011 23:20
  • This works under 2008 R2 as well! Good work people!
    24 februarie 2011 01:48
  • 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??

    24 aprilie 2011 17:31
  • Tanks Graeme your trick works for me today..:)

    Virgo

    7 iunie 2012 05:53
  • 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.

    • Propus ca răspuns de JuliusPIV 19 februarie 2013 15:11
    13 februarie 2013 16:31
  • 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.

    20 martie 2013 19:12
  • 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.


    • Editat de Core Tech 3 noiembrie 2013 16:20 mis-spellings
    3 noiembrie 2013 16:18