daily pastebin goal
69%
SHARE
TWEET

NSLookup a csv list of Hostnames

dfinf2 Oct 11th, 2013 83 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top