Skip to content

Instantly share code, notes, and snippets.

@markclowes
Created April 12, 2019 20:14
Show Gist options
  • Save markclowes/b538cff51b33e13c90500e8af4aa7c18 to your computer and use it in GitHub Desktop.
Save markclowes/b538cff51b33e13c90500e8af4aa7c18 to your computer and use it in GitHub Desktop.
Powershell ping that displays response time in Windows taskbar
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