Mark Clowes (38M 🇬🇧)

Index - Taskbar Ping using Powershell

2019-04-12

Games all have ping display options, why not the desktop?

This powershell script will keep your current ping visible in the taskbar:

https://gist.github.com/markclowes/b538cff51b33e13c90500e8af4aa7c18

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)