LLI Wiki — My Digital Knowledge Base

Ping with timestamps on Windows

PowerShell commands that add a timestamp to each ping reply and log connectivity to a file.

These commands add a timestamp to each ping reply, so you can see when packet loss or high latency occurred.

Continuous ping with timestamps to a file

ping -w 1000 -l 1500 -t sqlserver01 | Foreach{"{0} - {1}" -f (Get-Date),$_} >> C:\tools\ipTrace.log

Options used: -w timeout in milliseconds, -l packet size in bytes, -t ping until stopped.

Variants

Continuous ping to a computer name, displayed on screen:

ping.exe -t COMPUTERNAME|Foreach{"{0} - {1}" -f (Get-Date),$_}

Continuous ping to an IP address, written to a file:

ping -t 192.0.2.10|Foreach{"{0} - {1}" -f (Get-Date),$_} > c:\ping_log.txt

With PowerShell, Test-Connection with a timestamp calculated for each row:

Test-Connection -Count 9999 -ComputerName server01 | Format-Table @{Name='TimeStamp';Expression={Get-Date}},Address,ProtocolAddress,ResponseTime

Notes

Mastodon LLIMastodon SocialFosstodon