Ping with audible output

From Tech-Wiki
Jump to: navigation, search

Back to Misc

This command will read aloud the status whilst pinging. Useful to remove one of the sections, to notify you when the host goes down or up

Add-Type -AssemblyName System.speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
while($true) {
   if (Test-Connection 8.8.8.8 -Count 1 -quiet) {
       $speak.Speak("Host is up!")  }
   else {
       $speak.Speak("Host is down!") }
}