Get-Tag; Get-TagAssignment – Tag Commands from Powershell/PowerCLI are very slow on VMs with no tag – Workarounds or Bug?

This post was originally published on this site


I am using the PowerCLI plugin to PowerShell to perform repetitive actions on a 6.7 vCenter that include Get-Tag and Get-TagAssignment. The environment I administrate is thousands of VMs over 100+ hosts and when processing some VMs the tag commands can take > 60 seconds and in some cases several minutes to perform a simple assignment lookup on a single VM.



Is there a known issue (I’ve searched and seen many posts from years gone by on this) with a bug track or is there a workaround that can reduce the time for these actions?



Other Details:

My script is designed to make the fewest calls necessary after extensive Get-VM/Get-View filtering. I have verified the Tag commands are where the delays are coming from by using PS Write-Progress statements in front of the commands. After several runs I did note that VMs that do have a vCenter tag assigned process quickly and VMs that do not have a vCenter tag assigned are showing the delay. I have also tried using the community Powershell plugin: rCisTag and rCisTagAssignment which are showing the same behavior which suggests the API is a factor?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.