VMware Cloud Community
Knothead00
Contributor
Contributor

Assign Tags across multiple vcenters

All,

I am trying to updates tags across multiple vcenters 6.7 that are in linked mode.

This is what i am using:

$vCenters = 'mgt1.lab.local', 'tst1.lab.local', 'prd1.lab.local'
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Confirm:$false
Connect-VIServer -Server $vCenters -User JoeS -Password cowsallday!!

$vms = Get-VM Z-VRA*
$tag1 = Get-Tag -name "Rubrik No Backup"
$tag2 = Get-Tag -name "111-InfraEng"
$tag3 = Get-Tag -name "DC1"
$vms | New-TagAssignment -Tag $tag1, $tag2, $tag3

The first vcneter works but fails on the second vcenter and the third. If i run each venter in its own powershell session they work.

Thanks.

Tags (1)
0 Kudos
3 Replies
LucD
Leadership
Leadership

And if you use the Server parameter, mentioning all vCenters?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Knothead00
Contributor
Contributor

here is my line for multiple vcenters:  $vCenters = 'mgt1.lab.local', 'tst1.lab.local', 'prd1.lab.local' based on https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/PowerCli-Find-VM-in-Multiple-vCenter/m...

0 Kudos
LucD
Leadership
Leadership

I mean the Server parameter on the New-TagAssignment cmdlet


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos