Friday, March 4, 2011

Monitor single Website

$webClient = new-object System.Net.WebClient
$webClient.Headers.Add("user-agent", "PowerShell Script")

while (1 -eq 1) {
   $output = ""

   $startTime = get-date
   $output = $webClient.DownloadString("your website")
   $endTime = get-date

   if ($output -like "*your website*") {
      "Success`t`t" + $startTime.DateTime + "`t`t" + ($endTime - $startTime).TotalSeconds + " seconds"
   } else {
      "Fail`t`t" + $startTime.DateTime + "`t`t" + ($endTime - $startTime).TotalSeconds + " seconds"
   }

   sleep(300)
}

No comments:

Post a Comment