Network Segment Scan

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!


Posted Oct 27 2009, 08:00 AM by ps1

Comments

Brian Scott wrote re: Network Segment Scan
on 11-13-2009 12:50 PM

Awesome post, was looking for something like this.

Sylvain LESIRE wrote re: Network Segment Scan
on 03-22-2010 7:57 AM

for me

[system.Net.Dns]::Getaddress($_)

             >> it doesn't run ...

My solution uses :

[system.Net.Dns]::GetHostByAddress($_)

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.