Advertisement
dfinf2

NSLookup a csv list of Hostnames

Oct 11th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $servers = get-content "path_to_the_file"
  2. foreach ($server in $servers) {
  3.   $addresses = [System.Net.Dns]::GetHostAddresses($server)
  4.   foreach($a in $addresses) {
  5.     "{0},{1}" -f $server, $a.IPAddressToString >> C:\IPHOSTNAMEOUTPUT.txt
  6.   }
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement