Posts Tagged ‘while’

Wait for a Service to reach a specified status

Sunday, November 24th, 2013
$svc = Get-Service W3SVC
while($svc.State -ne 'Stopped')
{
   Start-Sleep -Seconds 1
}

... do your thing here...