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.
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.
You can download my script from github.