banner



How To Force Stop A Service That Ignores Shutdown

How to manually kill a Windows service process that is stack at "Stopping" or "Starting" land? Near Windows administrators have faced a problem when they try to start/stop/restart a service, simply it gets stuck with the Stopping (or Starting) condition. You won't be able to stop this service from the Service management panel (services.msc), since all command buttons for this service become inactive (grayed out). The easiest fashion is to restart Windows, but it is not e'er acceptable. Let's take a look at alternative means, which allows to forcefully kill a stuck Windows service or process without organisation reboot.

windows service stopping, starting, not responding

If within thirty seconds afterwards trying to stop the service, it doesn't stop, Windows displays this message:

Windows Could non stop the xxxxxx service on Local Computer Fault 1053: The service did not respond in a timely fashion.

The timeout that the Service Control Managing director waits for a service to start or stop can be changed past using the ServicesPipeTimeout registry parameter. If the service doesn't kickoff within the specified timeout, Windows sends an error to the Consequence Viewer (Event ID: 7000, 7009, 7011, a timeout was reached 30000 milliseconds). You lot can increment this timeout to 60 seconds, for example:

reg add HKLM\Organization\CurrentControlSet\Control /five ServicesPipeTimeout /t REG_SZ /d 600000 /f

This is useful when starting/stopping heavy services that do not have enough fourth dimension to properly terminate all processes and close the files (for case, MS SQL Server).

If you try to stop such a service from the control prompt: net stop wuauserv, a message appears:

The service is starting or stopping. Please endeavour over again later.

The service is starting or stopping. Please try again letter.

or:

Windows could not end the Service on Local Computer. [SC] ControlService Mistake 1061: The service cannot accept command letters at this time.

Contents:

  • How to Strength Kill a Stuck Windows Service Using TaskKill?
  • Force End a Stuck Windows Service with PowerShell
  • Analyzing the Wait Bondage on Hung Services Using ResMon
  • Killing a Hung Service Using Process Explorer

How to Force Kill a Stuck Windows Service Using TaskKill?

The easiest style to stop a stuck service is to utilise the born taskkill command-line tool. First of all, you need to find the PID (process identifier) of the service. As an example, let's have the Windows Update service. Its organization name is wuauserv (you can check the name in the service properties in the services.msc panel).

Important. Be attentive. Forced termination of critical Windows services can issue in BSOD or an unexpected system restart.

Run this control in the elevated command prompt (it is important, or access denied error will announced):
sc queryex wuauserv
In our case, the PID of the wuauserv service is 9186.
To force kill a stuck process with the PID 9186, run the command:

taskkill /PID 9168 /F

stopping stuck windows service in cmd using taskkill

SUCCESS: The process with PID 9168 has been terminated.

This command will forcibly cease the service process. At present you can start the service with the sc start servicename command or through the service management console

You tin stop a hung service more than elegantly without manually checking the PID of the service process. The taskkill tool has the /FI option, which allows you to use a filter to select the necessary services or processes. You lot can kill a specific service with the command:

taskkill /F /FI "SERVICES eq wuauserv"

Or you tin can skip the service name at all and killing all services in a hung state with the command:

taskkill /F /FI "status eq not responding"

Later that, the service that is stack in the Stopping status should stop.

You tin likewise utilize the taskkill utility to strength terminate the hang services on a remote computer:

taskkill /S mun-fs01 /F /FI "SERVICES eq wuauserv"

Forcefulness Terminate a Stuck Windows Service with PowerShell

You can as well utilize PowerShell to force the service to stop. Using the following command, y'all can get a list of services in the Stopping land:

Become-WmiObject -Grade win32_service | Where-Object {$_.country -eq 'finish pending'}

Or in the Starting land:

Get-WmiObject -Class win32_service | Where-Object {$_.land -eq 'first pending'}

list of services with "Stop pending" status

The Stop-Procedure cmdlet allows terminating the processes of all found services. The following PowerShell script will terminate all stuck service processes on Windows:

$Services = Go-WmiObject -Course win32_service -Filter "country = 'stop pending'"
if ($Services) {
foreach ($service in $Services) {
try {
Finish-Process -Id $service.processid -Force -PassThru -ErrorAction Stop
}
grab {
Write-Alert -Message "Error. Error details: $_.Exception.Message"
}
}
}
else {
Write-Output "No services with 'Stopping'.status"
}

powershell script to kill stuck service process

Yous must use the Become-CimInstance instead of the Get-WmiObject cmdlet in the new PowerShell Core half dozen.10/vii.10. Supervene upon the kickoff control of the script with:

$Services = Get-CimInstance -Course win32_service | where-Object state -eq 'stop pending'

Analyzing the Look Chains on Hung Services Using ResMon

You tin detect the process that caused the service to hang using the resmon.exe (Resource Monitor).

  1. In the Resource Monitor window, go to the CPU tab and observe the hung service procedure;
  2. Select the item Analyze Wait Chain from the context bill of fare;Resource Monito analyze wait chain
  3. In the new window, y'all will most likely see that your process is waiting for some other procedure. Cease the process. If yous are waiting for the svchost.exe or some other system procedure, you don't need to terminate it. Try to analyze the wait concatenation for this process. Detect the PID of the process that your svchost.exe is waiting for and impale it.

Killing a Hung Service Using Procedure Explorer

Even the local administrator cannot stop some processes that run under the Organisation account. The fact is that the admin account simply hasn't permissions on some processes or services. To stop such a process (service), you need to grant permissions to the service (process) to the local Administrators group and then kill them. To do this, nosotros will need two small tools: psexec.exe and ProcessExplorer (available on the Microsoft website).

  1. To kickoff the ProcessExplorer with the system privileges (runas Arrangement), use the command: PSExec -s -i ProcExp.exe
  2. In the Procedure Explorer process list, find the stuck service process and open its properties;
  3. Get to the Services tab, detect your service and click the Permissions button;proccess explorer service permissions
  4. Grant the Total Control correct in the service permissions for the Administrators group. Salvage the changes;granting full control permissions on windows service for admin
  5. At present endeavor to terminate the service procedure.

    Please notation, that the permission on the service is granted temporarily until it is restarted. To grant permanent permissions on service follow the article Fix permissions on a Windows service.

How To Force Stop A Service That Ignores Shutdown,

Source: http://woshub.com/killing-windows-services-that-hang-on-stopping/

Posted by: merkelladmis88.blogspot.com

0 Response to "How To Force Stop A Service That Ignores Shutdown"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel