Created
October 24, 2018 15:03
-
-
Save spy86/2bc764a321990b20f9f3d5cb748c81f3 to your computer and use it in GitHub Desktop.
Resolve IP Addresses from List of Host Names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-HostToIP($hostname) { | |
$result = [system.Net.Dns]::GetHostByName($hostname) | |
$result.AddressList | ForEach-Object {$_.IPAddressToString } | |
} | |
Get-Content "C:\Temp\Servers.txt" | ForEach-Object {(Get-HostToIP($_)) >> C:\Temp\Addresses.txt} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment