diff --git a/library/windows/win_service.ps1 b/library/windows/win_service.ps1 index bed140e7ff..70a3aa0005 100644 --- a/library/windows/win_service.ps1 +++ b/library/windows/win_service.ps1 @@ -68,7 +68,7 @@ If ($state) { } Set-Attr $result "changed" $true; } - ElseIf ($state -eq "stopped" -and $svcName -ne "Stopped") { + ElseIf ($state -eq "stopped" -and $svc.Status -ne "Stopped") { try { Stop-Service -Name $svcName -ErrorAction Stop }