function IsTheWebUrlUp {
try {
Invoke-WebRequest -Uri $webUrlLocation -UseBasicParsing `
-UseDefaultCredential | Select-Object StatusDescription `
| Tee-Object -Variable isWebUp | Out-Null;
return $isWebUp.StatusDescription -eq "OK"
}
Catch
{
write-host "Caught an exception:" -ForegroundColor Red
write-host "Exception Type: $($_.Exception.GetType().FullName)" -ForegroundColor Red
write-host "Exception Message: $($_.Exception.Message)" -ForegroundColor Red
return $false;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment