Sometimes as an administrator you may need to kill a service which is stuck at stopping in order to avoid having to reboot a server in the middle of the day.

Here’s what you need to do:


Step 1. Find out the Service Name

To do this, go in to services and double click on the service which has stuck.  Make a note of the “Service Name”.


Step 2. Find out the PID of the service

Open an elevated command prompt and type in:

sc queryex servicename

(where servicename is the name of the service you obtained from Step 1.)

Make note of the PID


Step 3. Kill the PID

From the same command prompt type in:

taskkill /f /pid [PID]

Where [PID] is the service number.

If it is successful you should receive the following message:

SUCCESS: The process with PID XXXX has been terminated.

Be careful of what you are killing though.  If you kill a critical windows service you may end up forcing the machine to reboot on it own.

Note: By forcing a service to stop you can also use these instructions to Kill a Windows Service which is stuck at starting as well.  This will allow you to restart the service.


Use Pskill from PsTools


Links

https://support.4it.com.au/article/how-to-kill-a-windows-service-which-is-stuck-at-stopping/

https://docs.microsoft.com/en-us/sysinternals/downloads/pstools