Requirements:
You need a file C:\temp\server.csv. This file have all names in it.
server1
server2
server3
server4
And the script to get all IPs.
$names = Get-Content C:\temp\names.csv
foreach ($name in $names )
{
[System.Net.Dns]::GetHostAddresses("$name") | select -ExpandProperty IPAddressToString
}
No comments:
Post a Comment