Windows Service with Status Stopping


Userlevel 7
Badge +11

Sometimes when trying to restart a service in Windows, the service happens to have a status of Stopping. As a result, it ends up getting stuck and without the possibility of giving the stop and start command. Here in this case, we can see the Veeam Backup Enterprise Manager service crashed:

 

So we need to terminate the process of this service through the command prompt. For that, you need to use the following command:

sc queryex <service>

Now we can obtain the PID (process identifier) of the process related to the crashed service:

 

With the PID number in hands, just run the command below:

taskkill /pid <PID> /f

This way the process is closed and you can start it again normally:

 


8 comments

Userlevel 7
Badge +20

Very cool @wolff.mateus learn something new today.  Will keep this reference for future use. Thanks for sharing 👍

Userlevel 7
Badge +10

Yep @wolff.mateus to check list of services you also can use

tasklist | findstr Services 

or 

tasklist | findstr Nameofservice 

this command list all (or specific) services with PID number and mem usage and you can kill it. 

The biggest problem is its troubleshooting that need to spent a lot of time. 😖

Userlevel 7
Badge +11

Yep @wolff.mateus to check list of services you also can use

tasklist | findstr Services 

or 

tasklist | findstr Nameofservice 

this command list all (or specific) services with PID number and mem usage and you can kill it. 

The biggest problem is its troubleshooting that need to spent a lot of time. 😖

Nice to know @Andanet! Thanks for that.

Userlevel 6
Badge +10

For the PowerShell folks:

$id = (get-wmiobject win32_service | where { $_.name -eq ‘ServiceName’}).processID

Stop-Process $id -Force

 

Userlevel 7
Badge +20

For the PowerShell folks:

$id = (get-wmiobject win32_service | where { $_.name -eq ‘ServiceName’}).processID

Stop-Process $id -Force

 

Ah yes good old PowerShell.  Love this for sure. 😀

Userlevel 7
Badge +6

I tend to use “taskkill /IM executablename.exe /F” to kill off the processes, but that requires you know the image name.

Userlevel 7
Badge +9

These are handy commands! A a lot of users will find this content useful..

Userlevel 7
Badge +9

For the PowerShell folks:

$id = (get-wmiobject win32_service | where { $_.name -eq ‘ServiceName’}).processID

Stop-Process $id -Force

 

Awesome! Sometimes, the Get-WMIObject cmdlets still works and other times they don’t. By the way, this cmdlets have been superseded with the CimInstance cmdlet.

Comment