(1..254) | % {
$ping = New-Object System.Net.Networkinformation.Ping
[Void](Register-ObjectEvent $ping PingCompleted -Action {
param($s, $e);
if($e.Reply.Status -ne "TimedOut") {
Write-Host $e.Reply.Address, ($e.Reply.RoundtripTime.toString() + "ms")
}
})
[void]$ping.SendPingAsync(“192.168.1.$_”)
}
I tested this on a small subnet. It finds 1-4 out of six active windows boxes while nmap and a lot of simple scanner apps find all six. If I use synchronus Ping.Send() it finds all of them. I tried everything and am looking for help as it seems to be a PS thing and I'm a PS noob..