Ping (ICMP) the host with logged timestamps

Ping is the most basic and the most oldest built-in tool, that every system/network administrator cannot live without when troubleshooting network connection at TCP/IP Layer-3. I sometimes had to make long time ping test for network latency issues.

Test-Connection is introduced since powershell 2.0. But, I found some issues while doing test-connection to some remote hosts, that is unable to display output instantly on console for some servers. Morever, it’s unable to display the timestamp when the server is pinging its destination. So, using the built-in ping.exe, I re-write some wrap-up to suite for logging purpose with the display of timestamp & write to file in the background.
What this script will do:
1) It will ping the specified destination host by 32 bytes of data for 10 minutes by default
2) It will write the output to file in the background while it pings to specified host.
Example Usage:
To make continuous ping to 192.168.43.1 from my machine for 10 hours:
.\Smart_Ping 192.168.43.1 -hr 10

I write some comments in the script for reader’s clearance. The image shown here is doing on my testing home machine.

Powershell Smart Ping Result
Fig-1: Ping Result (Test by disconnect & reconnect Network)

You can download my script from github.

One thought on “Ping (ICMP) the host with logged timestamps”

  1. Good morning, I would like to know if you have any variant of this script, so you can ping two remote PCs between them.
    example
    i am pc1
    I want to test ping between pc2 and pc3, in the same format.

Leave a Reply

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