Friday, May 13, 2016

Simple powershell script to report Internet unavailability

A simple script that check the state of internet connectivity and output time and date of unavailability to screen.


$ping = new-object System.Net.Networkinformation.Ping

While($true)
{
   $result = $ping.send("8.8.8.8")
   sleep 10
   $result1 = $ping.send("8.8.4.4")
   sleep 10

   if(($result.status -ne "Success") -and ($result1.status -ne "Success"))
   {
      $date = date
      $message = "Internet unavailable: " + $date
      echo $message
    }
    sleep 60
}

1 comment:

Anonymous said...

Mystino-Casino Review 2021 | Casino in Japan
Mystino-Casino is a relatively new online gambling establishment, but with new games and exciting features such as an ミスティーノ expanding Minimum deposit: $10Deposit options: 바카라사이트 Bitcoin and other currenciesMin Withdrawal: jeetwin $/€ 25 Rating: 5 · ‎Review by CasinoinJapan.com