I am having an issue getting my IPs to export out to my txt file. The Hostname works fine but IPs are not there any suggestions?
$ErrorActionPreference = ‘SilentlyContinue’get-content C:\computers.txt | foreach-object{
$a=([system.net.Dns]::GetHostAddresses($_)).IPAddressToString
if($? -eq $False) {add-content -path C:\computersips.txt -value "$_,Cannot resolve hostname"}
elseif($? -eq $True){add-content -path C:\computersips.txt -value "$_,$a"}
}