Have the following script that should return Exchange versions of the servers on a domain. However, the output shows the Name columns/field properly, but the Version and Role just have "System.Object[]" in each.
Import-Module ActiveDirectory
$domain = read-host "Enter the domain"
$ServerArray =@()
Get-ADComputer -SearchBase "OU=Servers,DC=$($domain),dc=local" -Filter {Name -like '*MBX*'} | Select -Exp Name | sort |
% {
Write-Host "Processing $_"
$obj = "" | Select "Name","Version","ServerRole"
$obj.Name = $_
$obj.Version = (Get-ExchangeServer).AdminDisplayVersion
$obj.ServerRole = (Get-ExchangeServer).ServerRole
$ServerArray += $obj
$obj = $null
}
$ServerArray | export-csv c:\users\$env:username\desktop\"$domain-ExchVer".csv -NoType