VMware Cloud Community
vmwarelicense12
Enthusiast
Enthusiast
Jump to solution

Get all unassigned tags with Powercli

I need a script to list all tags not used in vCenter, so I can delete them.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You could try something like this

$usedTags = Get-TagAssignment | %{"$($_.Tag.Category)-$($_.Tag.Name)"}

Get-Tag | where{$usedTags -notcontains "$($_.Category)-$($_.Name)"}


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

You could try something like this

$usedTags = Get-TagAssignment | %{"$($_.Tag.Category)-$($_.Tag.Name)"}

Get-Tag | where{$usedTags -notcontains "$($_.Category)-$($_.Name)"}


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

0 Kudos
vmwarelicense12
Enthusiast
Enthusiast
Jump to solution

Just what I was looking for. Thanks

0 Kudos