Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a crashed webserver which I should be able to shutdown with the following comamnd:

net stop https-myWebserver

However, I get the following error (on Windows 7 64-bit):

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

How can I force the service to stop/quit immediately? I'm hoping to avoid restarting the server.

share|improve this question
3  
I found the answer via google, but I can't answer my own question for 8 hours so here is the link to the resolution: community.spiceworks.com/how_to/show/312-stop-a-hung-service – David Oct 19 '12 at 15:07

You should be able to kill it via the Task Manager.

Right-click on taskbar -> Start Task Manager

If you can find it under the Processes tab:

Right click and select "End Process"

If you don't see it under Processes (or don't know which is the process for the service you want to kill),

While on the Processes tab

Check "Show processes from all users" in the lower left 
Then "View" menu and choose "Select Columns"
Check "PID" and hit OK
Go to the services tab to find the PID of the service you want to kill
Go back to Processes tab and Right-click -> End Process
share|improve this answer

You need to find the PID for the service, then kill it.
Use this command to find the PID:

tasklist /FI "services eq https-myWebserver"

And once you have the PID number, kill the process from task manager, or using taskkill.

Full detail over here: http://www.itprostuff.com/articles/find-pid-service.html

share|improve this answer

Powershell Advanced function from Mike Robbins blog

function Stop-PendingService {
<#
.SYNOPSIS
    Stops one or more services that is in a state of 'stop pending'.
.DESCRIPTION
     Stop-PendingService is a function that is designed to stop any service
     that is hung in the 'stop pending' state. This is accomplished by forcibly
     stopping the hung services underlying process.
.EXAMPLE
     Stop-PendingService
.NOTES
    Author:  Mike F Robbins
    Website: http://mikefrobbins.com
    Twitter: @mikefrobbins
#>
    $Services = Get-WmiObject -Class win32_service -Filter "state = 'stop pending'"
    if ($Services) {
        foreach ($service in $Services) {
            try {
                Stop-Process -Id $service.processid -Force -PassThru -ErrorAction Stop
            }
            catch {
                Write-Warning -Message "Unexpected Error. Error details: $_.Exception.Message"
            }
        }
    }
    else {
        Write-Output "There are currently no services with a status of 'Stopping'."
    }
}
share|improve this answer

If you have windows management framework 3.0 (powershell 3) or later, here's a Powershell one-liner.

Stop-Service -Name "https-myWebserver" -Force

There are also Start-Service and Restart-Service commands however the Start-Service command doesn't have a -force switch as it doesn't need one.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.