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. Update: This is much easier to do this with powershell. For example, with print spooler you can do:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    get-service | ? { $_.DisplayName -like "*print*" }
    
    Status   Name               DisplayName
    ------   ----               -----------
    Stopped  PrintNotify        Printer Extensions and Notifications
    Stopped  PrintWorkflowUs... PrintWorkflow_6dc45
    Running  Spooler            Print Spooler
    
    $ServicePID = (get-wmiobject win32_service | where { $_.name -eq 'spooler'}).processID
    Stop-Process $ServicePID -Force
    
  2. 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)
  3. 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

  4. 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

  5. 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:
    1
    
    sc queryex wuauserv
    
    • Kill the process:
    1
    
    taskkill /f /pid 334
    
    • Try starting the service.
  6. Never tried, but you could try stopping all processes with a specific service by using:

    1
    
    TASKKILL /F /FI "SERVICES eq wuauserv"
    
    • Powershell way to kill all hung services:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    $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"
       }
    }
    

-----------------------------------------------------------
Spotted a mistake in this article? Why not suggest an edit!
-----------------------------------------------------------

Comments