Is it possible to get a list of NSX security tags assigned to a VM using powershell?
I already tried the following but it only returns a value "securityTag" and not the actual name of the security tag(s).
PS C:\> Get-VM *dhcp* | Get-NsxSecurityTagAssignment
SecurityTag VirtualMachine
----------- --------------
securityTag dhcp01
Hi,
i guess following command can solve your issue,
Get-VM *dhcp* | Get-NsxSecuritytagassignment | select-object @{Name="SecurityTag"; expression = {$_.securitytag.name}}, VirtualMachine
Hi,
i guess following command can solve your issue,
Get-VM *dhcp* | Get-NsxSecuritytagassignment | select-object @{Name="SecurityTag"; expression = {$_.securitytag.name}}, VirtualMachine
This is exactly what I was looking for, thanks!
I am glad !! It is useful for you.
Just what I needed, many thanks.
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.