Created
April 12, 2019 20:14
-
-
Save markclowes/b538cff51b33e13c90500e8af4aa7c18 to your computer and use it in GitHub Desktop.
Powershell ping that displays response time in Windows taskbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[string]$ip = "8.8.8.8" | |
) | |
do { | |
$ping = Test-Connection $ip -Count 1 -ErrorAction SilentlyContinue | |
if ($ping -eq $null) { | |
$host.UI.RawUI.WindowTitle = "Ping: timeout" | |
write-host "Ping $ip : timeout" | |
} else { | |
$host.UI.RawUI.WindowTitle = "Ping: " + $ping.responsetime.ToString() | |
write-host "Ping $ip : $($ping.responsetime.ToString())" | |
} | |
sleep 1 | |
} until (0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment