How to get Vm type (Template/vcVM/vcacVM) using vro


find vm type for later case decision

var vmType = null;
var vcacVm = new vCACVirtualMachine() ;
vcacVm=Server.findAllForType("vCAC:VirtualMachine", "IsDeleted eq false and ExternalReferenceId eq '" + vcVm.id + "'")[0];

if (vcVm.config.template == true){
              vmType = "VcTemplate";
              System.log(vcVm.name+" is VcTemplate");
}

if (vcacVm != null && vmType == null){
// only search for managed flag if vcacVm is found (avoid error)
              if (vcacVm.isManaged == true){
                             vmType = "vCACVirtualMachine";
                             System.log(vcacVm.displayName+" is vCACVirtualMachine");
              }
}

if(vmType == null){
              vmType = "VcVirtualMachine";
              System.log(vcVm.name+" is VcVirtualMachine");
}

Comments

Popular posts from this blog

CSP-102547 Patch Upgrade Experience VMware Identity Manager 3.3.7 & Aria Suite Lifecycle 8.18.0 (Patch 5 → 7)

Bulk Import DFW Rules to NSX-T using Aria Automation

VCF 9 Automation vs Aria Automation 8.x (Part 1)