Home > PowerShell Scripting > resolving hosts to ip addresses in bulk

resolving hosts to ip addresses in bulk

Quick and easy Powershell script to resolve servers in a text document to ip addresses:

I’m using h:\book1.txt as my source in this case, change this for the textfile you wish to query.

$servers =@()
$servers += get-content h:\book1.txt
foreach ($server in $servers){
$ip = [System.Net.Dns]::GetHostAddresses(“$server”)
write-host $server – $ip
}

Voila! (this will also work in reverse)

Categories: PowerShell Scripting Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: