How to kill a service stuck in pending state.

WinRM ‘StopPending’ issues

Recently I logged into a machine and ran ‘Enable-PSRemoting -Force’ to end up with error code ‘2150858770’. WinRM service was in ‘StopPending’ state:

So upon checking I found that the WinRM service was having issues:

Solution, force kill the service.

All-right so what can we actually do to kill this? Behind a service is actually a process with a unique PID. Let’s get the PID of the process and kill the process instead:

Tada, problem resolved!

Bonus: enumerate dotnet type to find possible service status values.

Use ‘Get-EnumValue‘ to enumerate the dotnet object.

This article has 1 comments

  1. Julien Nury Reply


    Thanks for the tips. WinRm stucked in StopPending may also happen when using Register-PsSessionConfiguration.

    In adition, Workstation service and Cryptographic Services also run in the same process as WinRM, don’t forget to restart them if you kill the WinRM process 😉

Leave a Comment

Your email address will not be published. Required fields are marked *