This might take you < 1 minute to read.

Have you ever run a “ping -t” just to see if the network is unstable or just to know if and when a machine has been down.

I missed the timestamp, so I created a small script to log that for me.

$destination = "ping.sunet.se"
$path = "c:tempping$destination.log"
while ($true)
{
 $date = get-date
 if(!(Test-Connection -Cn $destination -BufferSize 16 -Count 1 -ea 0 -quiet))
 {
 add-content $path "$date - ping $destination NOT OK!"
 "$date - ping $destination NOT OK!"
 } else {
 "$date - ping $destination OK!"
 }
 sleep 1
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.