pamiller21
Enthusiast
Enthusiast

Apply NSX Sec Tags to a VM Folder

Jump to solution

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

0 Kudos
1 Solution

Accepted Solutions
RoderikdeBlock
Enthusiast
Enthusiast

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

0 Kudos
3 Replies
LucD
Leadership
Leadership

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

0 Kudos
RoderikdeBlock
Enthusiast
Enthusiast

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

0 Kudos
LucD
Leadership
Leadership

Thanks for repeating my answer :smileycry:


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

0 Kudos