How to kill a windows service which is stuck in a “Stopping” state
I recently ran into an issue where a service got stuck in the “Stopping” state. When I tried to stop it through the command line I received the following error. I had to kill it before I could start it again.
U:\>net stop snmp
The service could not be controlled in its present state.
More help is available by typing NET HELPMSG 2182.
U:\>sc queryex snmp
TYPE : 10 WIN32_OWN_PROCESS
STATE : 3 STOP_PENDING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x2
WAIT_HINT : 0x7530
PID : 54068
The following command kills the process for the service
U:\>taskkill /f /pid 54068