Wait for a Service to reach a specified status

$svc = Get-Service W3SVC
while($svc.State -ne 'Stopped')
{
   Start-Sleep -Seconds 1
}

... do your thing here...

Tags: ,

Leave a Reply

You must be logged in to post a comment.