SHARE
TWEET

NSLookup a csv list of Hostnames

dfinf2 Oct 11th, 2013 76 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. }
RAW Paste Data
Top