VRO code to remove a NSX security group from a VM

My previous post showed how to add a NSX security tag using VRO this one is similar but removes it:


Just VM name


tag is a array of names; connection is the restapi connection to NSX

Scriptable task:

Code sample

Code for cut and paste:

//name = ‘dev-214’;

vms = VcPlugin.getAllVirtualMachines();

for each (vm in vms) {

    if (vm.Name == name) {

        System.log(“VM name: ” + vm.name + ” MOID: ” + vm.id);

                              machineMOID = vm.id;



NSXSecurityTagManager.detachSecurityTagsOnVm(connection, tags, machineMOID);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.