Add dns lookups to this script

Hello powershell.org I’m very new to powershell and was given this script, I’ll post credit here after he says it’s okay if I share who he is.

I’d like to see if it’s possible to add DNS lookups to resolve hostnames in this.

#Ping Sweep
function New-IPRange ($start, $end) {
$ip1 = ([System.Net.IPAddress]$start).GetAddressBytes()
[Array]::Reverse($ip1)
$ip1 = ([System.Net.IPAddress]($ip1 -join ‘.’)).Address

$ip2 = ([System.Net.IPAddress]$end).GetAddressBytes()
[Array]::Reverse($ip2)
$ip2 = ([System.Net.IPAddress]($ip2 -join ‘.’)).Address

for ($x=$ip1; $x -le $ip2; $x++) {
$ip = ([System.Net.IPAddress]$x).GetAddressBytes()
[Array]::Reverse($ip)
$ip -join ‘.’
}
}
$ping = New-Object System.Net.NetworkInformation.Ping
New-IPRange 10.211.55.1 10.211.55.254 | ForEach-Object {$ping.Send($, 100)} | where {$.status -eq “Success”}

Yes, that is possible. The System.Net.Dns class have a method called GetHostEntry that you can use. You can read more about System.Net.Dns at http://msdn.microsoft.com/en-us/library/system.net.dns_methods(v=vs.110).aspx