vmwarelicense12
Enthusiast
Enthusiast

Get all unassigned tags with Powercli

Jump to solution

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

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

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
vmwarelicense12
Enthusiast
Enthusiast

Just what I was looking for. Thanks

0 Kudos