Nslookup range of IP adressess

I was searching for all machines in a certain IP address range to see which machines are in this range and what their host address is.

While trying to create a good working script for the purpose I needed, I came accross the following line which had like all I needed without using nslookup.

0..255 | % { [System.Net.Dns]::GetHostByAddress("192.168.1.$_") } 2> Out-Null

The range is for this script is 192.168.1.0  -> 192.168.1.255 with the 2>out-null only valid returns are replied in a nice list.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.