Kill a Stopping status windows service

How to: Stop a hung service

Sometimes as an administrator, need to end a service which is in stopping state without a reboot of the server.

The first step is to identify the PID (process identifier ) of the process.Using the below command we can easily identify the PID.Open a command prompt and type

sc queryex

This will list all the service along with the PID If you know the service name, you can run

sc queryex <servicename>

This will display the output like

DISPLAY_NAME: Remote Desktop Services
        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         : 0x1
        WAIT_HINT          : 0xea60
        PID                : 484
        FLAGS              : 

Note the PID and kill the process using the below command

taskkill /pid <pidnumber> /f