Since we upgraded our VI from vCenter Server 7.0.3 to v8.0.3 our Powershell scripts no longer get information from tags from the linked vCenter Servers.
The scenario is:
We have a vCenter Server called Wiltshire that has a cluster called Swindon.
We have another vCenter called Hampshire that has a cluster called Andover.
The 2 vCenter Servers are connected using Linked Mode with the Wiltshire vCenter Server being both the SSO and PSC.
There is a Tag Category called "Location" and hosts in the Swindon cluster are tagged "Swindon" and the hosts in the Andover cluster are tagged "Andover".
When I run the script, it connects to both vCenter Servers and outputs to a .CSV file with the results.
The files contains the name of each host. The location field is populated with the location tag for the hosts in the Swindon cluster but not the hosts in the Andover cluster.
Here's my scripts:
connect-viserver -server wiltshire.mynetwork.co.uk -user myuseraccount -Password mypassword -AllLinked
$hosts = Get-VMHost
$Output = foreach ($vmhost in $hosts){
Get-VMHost $vmhost | select Name,
@{N="Location";E={((Get-TagAssignment -Entity $_ -Category Location | select -ExpandProperty Tag).Name )}}
}
$Output | Export-Csv W:\VMware\Capacity-Reports\All-Host-details.csv -NoTypeInformation
'myuseraccount' is a local administrators on both vCenter Servers.
Here's the output:
Name Location
swindon1.mynetwork.co.uk Swindon
swindon2.mynetwork.co.uk Swindon
swindon3.mynetwork.co.uk Swindon
andover1.mynetwork.co.uk
andover2.mynetwork.co.uk
andover3.mynetwork.co.uk
Does anyone have any idea why this has started happening ???
-------------------------------------------