Avatar of IDPInc

asked on 

Run a Batch File as a Service (troubleshooting)

I've gone through the following steps to have a batch file run as a service:

1. 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.)

I tried using instrv in place of srvany.

When I try to start the service I get the error "Service did not respond to the start or control request in a timely fashion"

I played with the settings in the registry to change the "Path to Executable" but still no joy.  

The event viewer wasn't very help ful and when I ran an SC query i received:

C:\>sc query csss4

        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 1  STOPPED
                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN))

        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

Any ideas?
Windows Server 2003

Avatar of undefined
Last Comment

8/22/2022 - Mon