Kill pending windows service

Get-Service winrm -Verbose
$winrmService=Get-CimInstance -ClassName win32_Service |? {$_.Name -eq "winrm"}
$id=$winrmService.ProcessId
$status=$winrmService.State
if(($id -ne 0) -and ($status -ne "Running"))
{
   "it will kill winrm process"
    kill -Id $id -Force -Verbose
    winrm qc -q
}
Get-Service winrm -Verbose

Kill pending windows service

上一篇:C# 根据父窗口的标题和子窗口的类名返回子窗口的句柄


下一篇:C#控件交互效果类(也可以用作缩小面板放大,展示更多信息)