After getting frustrated with my fastping not displaying anything after using get-help, I asked the twitterverse for help, and they did! Super-duper thanks to @djryan (twitter/web) for the pointers.
<#
.SYNOPSIS
Ping a node as fast as you can.
.DESCRIPTION
Whereas the ping.exe utility keeps steady at 1 ping per second,
this will ping with custom wait periods as low as 0 milliseconds.
.Parameter ip
IP or hostname of network node.
.Parameter count
Number of pings to execute (defaults to 4)
.Parameter wait
Time to wait for a reply.
.Parameter sleep
Time to wait between pings.
.Parameter size
Number of bytes to send (all Null or 0).
.Parameter ttl
Time to live.
.INPUTS
None. You cannot pipe objects to fastping.
.OUTPUTS
Reply from {host}: status={status bytes={bytes} time={tripTime}
(xxx% loss)
.Example
PS> fastping.ps1 -ip josherickson.org -size 1337 -wait 1
Reply from josherickson.org: status=Success bytes=1337 time=81
Reply from josherickson.org: status=Success bytes=1337 time=96
Reply from josherickson.org: status=Success bytes=1337 time=81
Reply from josherickson.org: status=TimedOut bytes=1337 time=0
(25% loss)
.LINK
Original: http://josherickson.org/2009/09/24/586/ping-faster-from-powershell-with-fastping
.Notes
TODO: Add object based return instead of just text strings.
NAME: verb
AUTHOR: josherickson.org\josh
LASTEDIT: 09/25/2009
#>
param (
[string]$ip = "127.0.0.1",
[int]$count = 4,
[int]$wait = 5,
[int]$sleep = 0,
[int]$size = 32,
[int]$ttl = 128
)
$ping = new-object System.Net.NetworkInformation.ping
$pingo = new-object System.Net.NetworkInformation.PingOptions $ttl, $false
if($size -gt 65500) {
throw "`$size must be equal to or less than 65500";
}
$bsize = new-object byte[] $size;
$s = 0;
$f = 0;
for($i = 0; $i -lt $count; $i++) {
$pr = $ping.Send($ip, $wait, $bsize, $pingo)
$s += [int][bool]($pr.status -eq "Success");
$f += [int][bool]($pr.status -ne "Success");
"Reply from $($ip): status=$($pr.status) bytes=$size time=$($pr.RoundtripTime)" | write-host
sleep -Milliseconds $sleep;
}
if($f -gt 0) {
"(" + ((100/$count)*$f) + "% loss)";
} else {
"(0% loss)";
}
return;

