VMware Cloud Community
stevegott63
Contributor
Contributor

Powercli Get-Tagassignment command

So I have a question about the data being returned by my script and I hope someone can line me out pretty quickly.

This line of code '$az = (Get-tagassignment -Entity $Cluster -Category 'Availability Zone','OS License Enforcement')' is working and returns the correct amount of data but the data is presented as '$Cluster com.vmware.cis.tagging.TagAssociationModel com.vmware.cis.tagging.TagAssociationModel' , rather than what I really want which is the tag.

What am I missing here?

0 Kudos
2 Replies
stevegott63
Contributor
Contributor

I figured out a way around this where I am not setting the output of the get-tagassignment to a variable and now I see the data as desired. Thanks all!
0 Kudos
LucD
Leadership
Leadership

Is this returning what you are looking for?

Get-TagAssignment -Entity $Cluster -Category 'Availability Zone','OS License Enforcement' |

Select @{N='Entity';E={$_.Entity.Name}},

    @{N='Category';E={$_.Tag.Category.Name}},

    @{N='Tag';E={$_.Tag.Name}}


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

0 Kudos