just for the sake of learning, i started out with a script that was similar but didn't work, but had in the past... just curious as to what changed. Also why did you move the host array outside of the loop?
$viservers = "vCenter.net"
foreach ($singleViserver in $viservers)
{
Connect-VIServer $singleViserver
$HostReport = @()
Get-VMHost |Get-View |%{
$Report = "" | select Hostname, version, ip_address
$Report.Hostname = $_.Name
if($Report.version -like "3.5.*"){
$Report.ip_address =$_.Config.Network.ConsoleVnic.Spec.ip.ipaddress
}
else {$Report.ip_address =$_.Config.Network.ConsoleVnic[0].Spec.ip.ipaddress}
$HostReport += $Report
}
}
$HostReport | Export-Csv ".\Full-HostReport.csv" –NoTypeInformation