Purpose

The common Ping function has become a bit long in the tooth by now, its output not really useful. The Test-Connection cmdlet was an improvement in that regard, however the output tended to be a bit troublesome to handle. Finally Test-NetConnection was a major step forward, but not everybody can count on that being available (and even then, I'm missing some features).

So, I built my own Ping, with all the features I ever wanted ...

Features

How to make available

 

Adding it to the current session:

PowerShell
Edit|Remove
Import-Module .\Send-Ping.ps1
 

Examples

Example 1

PowerShell
Edit|Remove
ping 8.8.8.8 -n 50 -a
Sends 50 pings to 8.8.8.8, resolving the name and not waiting inbetween pings (It will send the next ping the moment it receives the answer to the previous one).

Example 2

PowerShell
Edit|Remove
ping 8.8.8.8 -t
 

Sends uninterrupted repeated pings to 8.8.8.8. Since no specific wait period was configured in combination with infinite pings, a one second minimum intervall between sending pings was configured. Visual feedback is automatically turned on when setting the -t switch. These settings are triggered by default, since infinite pings without visual feedback is fairly pointless, and too many pings in too little time with visual feedback will make the visual output become the bottleneck in the console speed (and flood the user with too frequent, yet pointless information).

Example 3

PowerShell
Edit|Remove
ping 8.8.8.8 -n 15000 -Wait 800 -Msec --'AfterFound' -sac 10 -i 1200
Sends 15000 pings to 8.8.8.8. There will be a minimum intervall of 800 Milliseconds between sending off two pings, each with a ttl of 1200 ms (the Msec switch means the input will be understood as ms, instead of the default seconds). For each ping, there will be visual feedback (-v) and after at least one Ping failed, the next 10 (-sac) successful pings will trigger a sound (-s) using default windows sounds.

Comment

Please note, that the return object shown is not all the information returned. Every property hides an entire collection of sub-properties, particularly the .Evaluation (statistics) and .Result (basic result) properties. Every raw value is exposed in its native type (int, double, whatever ...), so no string-parsing of results is necessary.