VMware Cloud Community
pamiller21
Enthusiast
Enthusiast
Jump to solution

Apply NSX Sec Tags to a VM Folder

Is there anyway to apply a NSX security tag to any VM within a VM Folder?

Reply
0 Kudos
1 Solution

Accepted Solutions
RoderikdeBlock
Enthusiast
Enthusiast
Jump to solution

You can try something like this. (Requires PowerNSX)

Get-Folder "XenDesktops" | Get-VM | %{ $_ | New-NsxSecurityTagAssignment -ApplyTag -SecurityTag (Get-NsxSecurityTag internet_access) }

Roderik de Block


Blog: https://roderikdeblock.com

View solution in original post

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

Have a look at Add NSX-T Tags To Virtual Machines with PowerShell

It uses the REST API.

You can also use PowerNSX and the New-NsxSecurityTagAssignment function.


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

Reply
0 Kudos
RoderikdeBlock
Enthusiast
Enthusiast
Jump to solution

You can try something like this. (Requires PowerNSX)

Get-Folder "XenDesktops" | Get-VM | %{ $_ | New-NsxSecurityTagAssignment -ApplyTag -SecurityTag (Get-NsxSecurityTag internet_access) }

Roderik de Block


Blog: https://roderikdeblock.com
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Thanks for repeating my answer :smileycry:


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

Reply
0 Kudos