Ping with audible output

From Tech-Wiki
Revision as of 12:37, 3 October 2024 by Fabricio.Lima (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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!") }
}