Home / Solution / Killing a Windows Service that Hangs on Stopping or Not Responding

Killing a Windows Service that Hangs on Stopping or Not Responding

How to manually forcefully cease a hung Windows service course of that hangs at “Stopping” or “Not responding”? Most Windows directors have confronted a drawback, after they attempt to cease (restart) a service, but it surely will get caught with the Stopping standing. You received’t be capable of cease this service from the Service administration console (providers.msc), since all management buttons for this service turn out to be inactive. The simplest way is to restart Windows, however it’s not all the time acceptable. Let’s contemplate an alternate method, which permits to forcefully kill a caught Windows service or course of with out system reboot.

If inside 30 seconds after attempting to cease the service, it doesn’t cease, Windows shows this message:

Windows Could not cease the xxxxxx service on Local Computer
Error 1053: The service didn’t reply in a well timed style.

If you attempt to cease such a service from the command immediate: internet cease wuauserv, a message seems:

The service is beginning or stopping. Please strive once more letter.

How to Terminate a Hung Windows Service Process Using TaskKill?

The best option to cease a caught service is to make use of taskkill. First of all, you could discover the PID (course of identifier) of the service. As an instance, let’s take Windows Update service, its system identify is wuauserv (you possibly can examine the identify within the service properties within the providers.msc console).

Important. Be attentive. A compelled shutdown of essential Windows providers may end up in BSOD or an sudden system restart.

Run this command within the elevated command immediate (it is necessary, or entry denied error will seem):
sc queryex wuauserv
In our case the PID of the wuauserv service is 816.
To power cease a hung course of with the PID 816, run the command:

taskkill /PID 816 /F

SUCCESS: The course of with PID 816 has been terminated.

You can cease a hung service extra elegantly with out checking the service PID manually. The taskkill utility has the /FI choice, which lets you use a filter to pick out the required providers or processes. You can shutdown a particular service with the command:

taskkill /F /FI "SERVICES eq wuauserv"

Or you possibly can skip the service identify in any respect and killing all providers in a hung state with the command:

taskkill /F /FI "standing eq not responding"

After this, the service that hangs within the Stopping standing ought to cease.

PowerShell: Stop Windows Service with Stopping Status

You may use PowerShell to power the service to cease. Using the next command you will get a record of providers within the Stopping state:

Get-WmiObject -Class win32_service | Where-Object

The Stop-Process cmdlet permits to terminate the processes of all discovered providers. Let’s mix each operations into a loop and get a script that mechanically terminates all of the processes of the caught providers:

$Services = Get-WmiObject -Class win32_service -Filter "state = 'cease pending'"
if ($Services)
else

Identify a Hang Process Using Resmon

You can detect the method that induced the service to freeze utilizing the resmon (Resource Monitor).

  1. In the Resource Monitor window, go to the CPU tab and find the hung service course of;
  2. Select the merchandise Analyze Wait Chain from the context menu;
  3. In the brand new window, you’ll probably see that your course of is ready for one more course of. End the method. If you might be ready for the svchost.exe or one other system course of, you don’t have to terminate it. Try to research the wait chain for this course of. Find the PID of the method that your svchost.exe is ready for and kill it.

Process Explorer: Killing a Hung Process Running in SYSTEM Context

Even the native administrator can’t terminate some processes that run within the SYSTEM context. The truth is that the admin account merely haven’t permissions on some processes or providers.  To cease such a course of (providers), you could grant permissions to the service (course of) to the native Administrators group, after which terminate them. To do that, we are going to want two small instruments: psexec.exe and ProcessExplorer (out there on the Microsoft web site).

  1. To run ProcessExplorer with the system privileges ( SYSTEM), run the utility on this method: PSExec -s -i ProcExp.exe
  2. In the Process Explorer course of record, discover the caught service course of and open its properties;
  3. Go to the Services tab, discover your service and click on the Permissions button;
  4. Grant the Full Control proper within the service permissions for the Administrators group. Save the modifications;
  5. Now attempt to cease the service course of.
    Please be aware, that the permission on the service are granted briefly, previous to its restart. To grant everlasting permissions on service comply with the article .

Check Also

Wi-Fi Network Disappears After Sleep/Wake/Hibernate in Windows 10

I’ve seen an odd factor that my model new Lenovo laptop computer loses Internet connection …

Leave a Reply

Your email address will not be published. Required fields are marked *