1 Reply Latest reply on Aug 7, 2020 12:32 PM by Bayu Wibowo

    NSX Security Tags

    mike2493 Lurker

      This code was posted elsewhere on VMTN, which is exactly what was required.

       

      Get-VM | Get-NsxSecurityTagAssignment | select-object VirtualMachine, (@{Name="SecurityTag"; expression = {$_.securitytag.name}})

       

      Is there anyway of formatting the output, as the output of this command lists the VM multiple times.

       

      If possible I'd like the VM name and then one column per security tag.

       

      VM1, Tag1, Tag2, Tag3

       

      rather than

       

      VM1,Tag1

      VM1,Tag2

      VM1,Tag3

       

      If possible I'd also like vcenter and NSX Security tags in the same report.

        • 1. Re: NSX Security Tags
          Bayu Wibowo Master
          User ModeratorsCommunity Warriors

          As an alternative, if you have vRNI you can search all vm: vmware vm then export to CSV

           

          Under the selected properties, add Name, Tag, Security Tags so you will have VM Name, vSphere Tags & Custom Attributes, and Security Tags in one row

          Here's the sample of an exported CSV

          Bayu Wibowo | VCIX6-DCV/NV
          Author of VMware NSX Cookbook http://bit.ly/NSXCookbook
          https://github.com/bayupw/PowerNSX-Scripts
          https://nz.linkedin.com/in/bayupw | twitter @bayupw