I'm using this to test for return of service: $loop = "loop" do {$response = $null; Start-Sleep -Seconds 5 try {$response = Invoke-WebRequest " https://login.microsoftonline.com/common/oauth2/ " -ErrorAction SilentlyContinue | select status*} catch {Write-Host "Down $(get-date)"} finally {} if ($response) {Write-Host "OK" ($response).StatusCode (Get-Date)} } while ($loop -eq "loop")
At line:1 char:16 + $loop = "loop" do {$response = $null; Start-Sleep -Seconds 5 try {$re ...
+ ~~
Unexpected token 'do' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken