dns lookup script

new to this board, saw on techED about this site. here is a small script i use to look up IP to DNS names:

$Computerlist = get-content "./IPcomplist.txt"
foreach ($i in $Computerlist){
$rs = [System.Net.Dns]::GetHostbyAddress($i).HostName
#FQDN driven
#$rsIP = [System.Net.Dns]::GetHostAddresses($i)|select-object IPAddressToString -expandproperty  IPAddressToString
$formatoutput = ($i + "," + $rs)
write-output $formatoutput  |out-file Report_IP_FQDN.txt -append
}
$i=0
write-output "script has finished running"

-Nexghost

And as a note to folks working on Windows Server 2012, Windows 8, or later, there’s a native cmdlet that will do this also. See http://technet.microsoft.com/en-us/library/jj590781.aspx for Resolve-DnsName.

been playing with the new “resolve-dnsname” cmdlet, actually pretty nice. maybe I can not have to use dig so much now…