Hostname to IP
10-11-2017
Language or Platform: Powershell
Code:
function Get-HostToIP($hostname) {
$result = [system.Net.Dns]::GetHostByName($hostname)
$result.AddressList | ForEach-Object {$_.IPAddressToString }
}
Get-Content "C:\resolve\host.txt" | ForEach-Object {(Get-HostToIP($_)) >> C:\resolve\ip.txt}
Back