Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to stop WINRM service when it stuck at STOP_PENDING state? #749

Open
nimezul opened this issue Aug 4, 2022 · 0 comments
Open

how to stop WINRM service when it stuck at STOP_PENDING state? #749

nimezul opened this issue Aug 4, 2022 · 0 comments

Comments

@nimezul
Copy link

nimezul commented Aug 4, 2022

When we execute a PowerShell DSC task, in task, the third-party program tries to stop the WINRM service, but it is stuck at the STOP_PENDING state.

So, after executing the third-party program, the DSC Resource will help it to stop the WINRM service.

the way is that we find the process of the WINRM service, kill it, and restart the WINRM service.

$winrmSvc = Get-CimInstance -ClassName win32_service | ?{$_.Name -eq "winrm"}
$winrmPID = $winrmSvc.ProcessId
Stop-process -Id $winrmPID
Start-Service WINRM

but, on Windows Server(2012R2/2016), the WINRM service shares a process with other services
image

kill the process, the other service would be stopped as well.

I tried to separate the SvcHost services for WINRM and found this link:https://docs.microsoft.com/en-us/windows/application-management/svchost-service-refactoring
it seems this method is not working on Windows Server.

So, What shall I do?

Thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant