Kill a ‘hung’ service / ‘Stopping’ Service via CMD

,

Kill a ‘hung’ service / ‘Stopping’ Service via CMD

Sometimes we will encounter times when a service is stuck in a ‘Stopping’ state, even if we right click the service to stop it, it will remain in a ‘Stopping’ state indefinitely. The two ways to sort this out are either a restart (which is time consuming and may interrupt your production environment) or to manually ‘Kill’ the service via CMD. 
1. Identify the service ID. This can be done through task manager. As we can see the MSSQLSERVER service I am choosing as an example is ‘Running’ but lets pretend its ‘Stopping’.
We can see the PID for this is ‘1628’ – make a note of this. 

2. Open CMD (Command Prompt). Ideally this should be run with Administrator permissions. 
Use the following command: 
taskkill /f /pid PID  
3. Then press enter! 
Andy
The following two tabs change content below.

Andy, Software Engineer

Andy is Software Engineer at Metaphorix