VMware Cloud Community
Dimon_SPB
Contributor
Contributor
Jump to solution

How to Increase Tag Performance via Tagging Service

Want to Increase Tag Performance on article https://blogs.vmware.com/performance/2019/06/writing-performant-tagging-code-tips-and-tricks-for-pow...

Does not get example 9B: Tagging Service

tags.jpg

How do I get all VM attached tags via Tagging Service?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The parameter property names are case-sensitive I'm afraid.

So 'id' instead of 'Id' and 'type' instead of 'Type'

Try like this

$vmName = 'MyVM'


$vm = Get-VM -Name $vmName


$allTagAssociationMethodSVC = Get-CisService com.vmware.cis.tagging.tag_association

$vmid = New-Object PSObject -Property @{

   id = $vm.ExtensionData.MoRef.Value

   type = $vm.ExtensionData.MoRef.Type

} 

$allTagAssociationMethodSVC.list_attached_tags($vmid)


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

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

The parameter property names are case-sensitive I'm afraid.

So 'id' instead of 'Id' and 'type' instead of 'Type'

Try like this

$vmName = 'MyVM'


$vm = Get-VM -Name $vmName


$allTagAssociationMethodSVC = Get-CisService com.vmware.cis.tagging.tag_association

$vmid = New-Object PSObject -Property @{

   id = $vm.ExtensionData.MoRef.Value

   type = $vm.ExtensionData.MoRef.Type

} 

$allTagAssociationMethodSVC.list_attached_tags($vmid)


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

0 Kudos