Friday, September 3, 2010

Windows Service is in Stopped State

Cuase: Sometimes you can find a windows service status in Stopping state and you will not be able to start/stop it

Resolution: Kill the process forcibly using the below steps

1) Query the Service from elevated Command Prompt using the below command to get its PID details.
sc queryex winrm (here I am querying Windows Remote Management service)
2) This will give you the following output


SERVICE_NAME: winrm

TYPE : 20 WIN32_SHARE_PROCESS

STATE : 3 STOP_PENDING

(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)

WIN32_EXIT_CODE : 0 (0x0)

SERVICE_EXIT_CODE : 0 (0x0)

CHECKPOINT : 0x0

WAIT_HINT : 0xea60

PID : 1264

FLAGS :
 
3) Make a note of PID in the above output and kill the process using the below command.
taskkill /PID 1264 /F
The result will be "SUCCESS: The process with PID 1264 has been terminated."
 
Now you can see the service in stopped state.
 
Note: Please use it on your own risk

No comments: