VMware Cloud Community
suttonsa90
Contributor
Contributor
Jump to solution

Tagging VMs with specific category

I'm trying to assign a tag to a VM from a specific category. I have duplicate tags called "false" under different single-cardinality categories. When I apply tag "false" to a VM, it applies all tags named "false" to the VM. How can I only apply the tag from a specified tag?

$vm = Get-VM -Name <vm_name>

New-TagAssignment -Entity $vm -Tag "false"

Tags (2)
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You can use the Get-Tag cmdlet

$vm = Get-VM -Name <vm_name>

$tag = Get-Tag -Name 'false' -Category 'Cat1'

New-TagAssignment -Entity $vm -Tag $tag


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

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

You can use the Get-Tag cmdlet

$vm = Get-VM -Name <vm_name>

$tag = Get-Tag -Name 'false' -Category 'Cat1'

New-TagAssignment -Entity $vm -Tag $tag


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

suttonsa90
Contributor
Contributor
Jump to solution

I should've known better. Thanks LucD, that worked!

Reply
0 Kudos