Network Segment Scan

by Oct 27, 2009

In a previous tip, we created a Check-Online filter to eliminate offline systems from a list of IP addresses and computer names. Now, find out what you can do with that! For example, try to auto-generate IP-addresses for a network segment and return host information for all systems responding to ping.

However, be sure you replace "172.16.44." in the example below with your own network:

filter Check-Online {
trap { continue }

. {
$obj = New-Object system.Net.NetworkInformation.Ping
$result = $obj.Send($_, 1000)
if ($result.status -eq 'Success') { $_ }
}
}

1..255 | % { "172.16.44.$_" } | Check-Online |
% { [system.Net.Dns]::Getaddress($_) }

Twitter This Tip! ReTweet this Tip!