How to Kill a Hung Service without a Reboot…

From time to time a service will go into a “Stopping” state where you seem to be unable to either stop the process or even restart it without a reboot of the machine.  There is another way to stop a hung service that doesn’t require a reboot:

In order to complete this task you will need to know the exact name of the service for which you want to stop. To do this you should follow the below steps

1.  Open the service applet from Administrator Tools menu, or by Right Clicking on My Computer and clicking on Manage, and locate Services.

2.  Locate the service in question, for this example I will use the SMTP “Simple Mail Transfer Protocol”

3.  Double click on that service and you will see the short name of the service which I’ve outlined in the below screenshot. As shown in the below screen shot the short service name is SMTPSVC

4.  Open a Command prompt window, (start, run, CMD or COMMAND)

5.  Type the following without quotes. “sc queryex SMTPSVC” and press enter:

This will output a similar screen as shown here.

Note the PID number shown, you will need this for the next step.

6.  Type the following without quotes “taskkill /PID 8784 /F

Replace the example PID with the PID of the service you are trying to kill, or restart.  The switch /F is used to force the termination of the service in question.  Note: you will get a notice similar to the following if the command was successful:

SUCCESS: The process with PID 8784 has been terminated.

Once completed simply restart the service if necessary, you can do this from the Services console or you can do this from the command prompt using commands such as these:

sc start smtpsvc

or

net start smtpsvc

One thought on “How to Kill a Hung Service without a Reboot…

  1. Not working. Still stuck in STOP_PENDING state. I get “SUCESS: the process has been terminated.” Then when I try to start “The service is starting or stopping. Please try again later.” When I try to stop it a second time, I get “There is no running instance of the task”. Ghost task that won’t die. An App has been processing my data for three days, rebooting is not an option.

Leave a comment