I am working on enhancing my vSphere release tagging script with the ability to tag the vCenter with a human-readable release name. As shown in the screenshot, it’s easy enough in the UI.
However, in PowerCLI there is no commandlet like
get-vcenter. After many tries I gave up trying to force the object returned from
to accept any tag-related operations. Today, I had the idea of working backwards from the assigned tags with
Yet, the returned entity puzzled me - I didn’t know about the entity type “Datacenters” (only Datacenter). Finally, my dear old friend
get-member gave me the answer:
TIL, the vCenter object is handled a folder!
So, if you want to assign a tag to the vCenter get the datacenters folder and it works like a charm…
Get-Folder "Datacenters" | New-TagAssignment (Get-Tag -name $TagName -Category $TagCategory)