Posts Tagged ‘Killing a windows process’

Killing a Windows Service That hangs on Stopping

October 2, 2009

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:

SERVICE_NAME: DirXMLRemote 8002
        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