Automation

 View Only
  • 1.  Tagging VMs with specific category

    Posted Apr 22, 2020 04:24 PM

    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"



  • 2.  RE: Tagging VMs with specific category
    Best Answer

    Posted Apr 22, 2020 04:33 PM

    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



  • 3.  RE: Tagging VMs with specific category

    Posted Apr 22, 2020 05:09 PM

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