Killing a Windows Service That hangs on Stopping

Today I needed to restart the remote loader service running on Active Directory for Identity manager as the sync had stopped working.  However when I clicked the stop the service just hung in a ‘stopping’ state.  Now as this is running on a domain controller I didn’t really want to reboot the machine to kill the service off, so a quick google and I came across this solution:

1. Open a command prompt and query the service (in this case dirXMLRemote) by using the sc command

sc queryex dirXMLRemote

2. This will give you the following information:

        TYPE               : 110  WIN32_OWN_PROCESS  (interactive)
        STATE              : 3  STOP_PENDING
                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN))
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0
        PID                : 5172
        FLAGS              :

3. Here you can find the process identifier (PID), so then you can kill the associated process by using the taskkill command.

taskkill /PID 5172 /F



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: