Tags and TagCategories in VCSA are case-sensitive, to test if a tag already exists you have to know the exact case. Please add an option to the tagging cmdlets to make it behavior case-insensitive.
I know this has been here a while but I just encountered it with PowerCLI 12.6.0 and vCenter 7.0u3c. Get-Tag is case-sensitive but New-Tag is not. I have some automation that synchronizes tags between the asset manager DB and vCenter. I came across this issue when checking for tags and creating them if they don't already exist. i.e. There is an existing tag named "TEST" in vCenter. I come across a tag named "Test" in the DB. Get-Tag -Category "Purpose" -Name "Test" finds nothing so I do a New-Tag -Category "Purpose" -Name "Test" which fails because the tag already exists. It's that inconsistency that is frustrating. Get-Tag -Category "Purpose" -Name "[T]est" does work as a work-around, so thanks for that, but it shouldn't be necessary.
In the meantime - a workaround is to use some wildcard characters in the -Name parameter of Get-Tag. This will force the filtering to be done client-side which is case-insensitive. For example: you can just put one of the characters of the name in square brackets (square brackets indicate a range of characters so the new filter will be equivalent to the one without brackets):
Adding to Steve's comments, we found out that there is a vCenter version dependency with this issue. vCenter 6.5 is the one experiencing the issue, vCenter 6.0 behaves as expected.
Secondary question, how are you doing this checking? I specifically went and used the -Name parameter on both Get-Tag and Get-TagCategory... and both returned regardless of case on the string.
After a server side fix that was required the cmdlets are no longer case-sensitive when using PowerCLI 13.1 and vSphere 8.0
I know this has been here a while but I just encountered it with PowerCLI 12.6.0 and vCenter 7.0u3c. Get-Tag is case-sensitive but New-Tag is not. I have some automation that synchronizes tags between the asset manager DB and vCenter. I came across this issue when checking for tags and creating them if they don't already exist. i.e. There is an existing tag named "TEST" in vCenter. I come across a tag named "Test" in the DB. Get-Tag -Category "Purpose" -Name "Test" finds nothing so I do a New-Tag -Category "Purpose" -Name "Test" which fails because the tag already exists. It's that inconsistency that is frustrating. Get-Tag -Category "Purpose" -Name "[T]est" does work as a work-around, so thanks for that, but it shouldn't be necessary.
Hi Marcel,
The bug is logged internally.
In the meantime - a workaround is to use some wildcard characters in the -Name parameter of Get-Tag. This will force the filtering to be done client-side which is case-insensitive. For example: you can just put one of the characters of the name in square brackets (square brackets indicate a range of characters so the new filter will be equivalent to the one without brackets):
Get-Tag -Name "[T]agName"
Regards,
Angel
Adding to Steve's comments, we found out that there is a vCenter version dependency with this issue. vCenter 6.5 is the one experiencing the issue, vCenter 6.0 behaves as expected.
Marcel, thanks for the heads up. I have filed a bug to get this issue resolved.
Secondary question, how are you doing this checking? I specifically went and used the -Name parameter on both Get-Tag and Get-TagCategory... and both returned regardless of case on the string.
What version of PowerCLI are you using? I just tested with 6.5.4, and it definitely is not case sensitive.