Scenario: You want to quickly gather the IP addresses from a list of HostNames. Gather your hostnames into a variable and run the following script:
#Gather into your Variable ( I am gathering a list of all Exchange 2010 servers) – You could also Import-CSV or other import types.
$Servers = Get-ExchangeServer ExSvr* | Where AdminDisplayversion -like *14* | Sort Name
#Loop It! You can also write it out to a file as well by inserting Out-File with -append OR other export types.
$servers | %{ $IP = [System.Net.DNS]::GetHostAddresses($_.Name).IPAddressToString $Name = $_.Name +":"+$IP Write-Host $name }