Powershell Script to check the status of a website
Here is a script to check the status of a website
www.blogger.co.nz is OK!
$HTTP_Request = [System.Net.WebRequest]::Create('http://www.blogger.co.nz')Output will be like PS C:\\check-sparkdigitalwebsite.ps1
$HTTP_Response = $HTTP_Request.GetResponse()
$HTTP_Status = [int]$HTTP_Response.StatusCode
If ($HTTP_Status -eq 200) {
Write-Host $HTTP_Request.Host "is OK!"
}
Else {
Write-Host "The Site may be down, please check!"
}
$HTTP_Response.Close()
www.blogger.co.nz is OK!
0 comments :