Service Stuck Starting Or Stopping

1 minute read

Description:

If you have an issue with a service that is stuck “Starting” or “Stopping” but it won’t complete, follow these steps:

To Resolve:

  1. Query the process – To kill the service you have to know its PID or Process ID. To find this just type the following in at a command prompt:
    sc queryex servicename
service-stuck-1

Replace ‘servicename’ with the services registry name. For example: Print Spooler is spooler. (See Picture)

  1. Identify the PID – After running the query you will be presented with a list of details. You will want to locate the PID. (Highlighted)
service-stuck-2
  1. Run the “TaskKill” command – Now that you have the PID, you can run the following command to kill the hung process:
    taskkill /f /pid [PID]

This will force kill the hung service. (See Picture)

service-stuck-3

Another way to stop a stopping service:

Set all restart of service options to Take No Action:
Run – services.msc – right-click Target-Service – Properties – Recovery tab #Make sure the First\Second\Subsequent failures are all set to “Take No Action”

Get the PID of your target service using:

sc queryex wuauserv

Kill the process:

taskkill /f /pid 334

Try starting the service.

Never tried, but you could try stopping all processes with a specific service by using:

TASKKILL /F /FI "SERVICES eq wuauserv"

Powershell way to kill all hung services:

$Services = Get-WmiObject -Class win32_service | Where-Object {$_.state -eq 'stop pending'}
foreach ($service in $Services) 
{
	try
	{
		Stop-Process -Id $service.processid -Force -PassThru -ErrorAction Stop
	}
	catch
	{
		Write-Error -Message "Error : $_.Exception.Message"
	}
}

Set all restart of service options to Restart the Service:
Run – services.msc – right-click Target-Service – Properties – Recovery tab #Make sure the First\Second\Subsequent failures are all set to “Restart the Service