Ping with timestamp

During a troubleshooting exercise a couple of weeks ago there was a need to log the pings from two different sources for later comparison. Of course this meant having a timestamp associated with each.

A quick search of Stackoverflow turned up the following thread:

Ping with timestamp

I think my favoured solution is the one that uses Powershell, as per below.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\

ping.exe -t twitter.com|Foreach{"{0} - {1}" -f (Get-Date),$_} > test.txt

In a second Powershell window you can also tail the output, thusly:

Get-Content filenamehere -Wait -Tail 30

Leave a Reply

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