Thanks for responding... Yes I've tried the vCenter Servers individually but no luck.
-------------------------------------------
Original Message:
Sent: Oct 01, 2025 01:38 AM
From: rkabelich
Subject: Powershell script not getting information from tags - vCenter Server linked mode.
Hi Rob,
did you try "andover" alone? Do you get any output from there?
Hint:
Never use password as plain text in scripts. Use get-credential instead and save the credential for later usage.
Save credential:
$credential = get-credential
$credential | export-clixml -Path "path\to\your\credential.xml"
Usage:
$credential = import-clixml-Path "path\to\your\credential.xml"
connect-viserver yourVIServer -credential $credential
Original Message:
Sent: Sep 30, 2025 05:30 AM
From: Rob Preston
Subject: Powershell script not getting information from tags - vCenter Server linked mode.
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 ???
-------------------------------------------