how to get vcVms by regex expression

get vcVms by regex

var vmPattern="[a-z]{5}[0-9] [3]"
var allVms = VcPlugin.getAllVirtualMachines();
 var foundVms = new Array ();
// Check if the VM match the regexp
for (var i in allVms) {
   if (allVms[i].name.match(vmPattern)) {
      foundVms.push(allVms[i]);
      System.log("found Vm: "+allVms[i].name);
   }
}            

return foundVms;

Comments

Popular posts from this blog

Creating Snapshots for Unmanaged VMs in Aria Automation (vRealize Automation)

Bulk import security policies into Palo Alto Networks firewalls

Automating Tag Creation & Assignment to VMs with vRA + vRO