Difference between revisions of "Ping with audible output"

From Tech-Wiki
Jump to: navigation, search
(Created page with "Category:Microsoft '''Back to Misc''' This command will ping a host whilst printing the current time stamp. Useful for long pings when you need to know...")
 
 
Line 2: Line 2:
 
'''[[Microsoft#Misc|Back to Misc]]'''
 
'''[[Microsoft#Misc|Back to Misc]]'''
  
This command will ping a host whilst printing the current time stamp. Useful for long pings when you need to know when the packet was lost
+
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
 
  Add-Type -AssemblyName System.speech
 
  $speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
 
  $speak = New-Object System.Speech.Synthesis.SpeechSynthesizer

Latest revision as of 13:37, 3 October 2024

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!") }
}