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

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