Nick's Blog

PowerShell to get bulk IP addesses’ DNS name


$HOSTS = @('192.168.185.234',
'192.168.162.13',
'192.168.36.23',
'192.168.128.7',
'192.168.128.19',
'192.168.128.18',
'192.168.36.135',
'192.168.163.7',
'192.168.163.13',
'192.168.36.39',
'192.168.162.13',
'192.168.128.19',
'192.168.128.18',
'192.168.163.14',
'192.168.163.13',
'192.168.161.18'
)

foreach ($HOSTName in $HOSTS)
{
try{
[System.Net.Dns]::GetHostbyAddress($HOSTName)
}
catch
{
$HOSTName + ' cannot be resolved by DNS'
}
}