Orchestrator Function: Find a vCACEntity object or a vCenter Cluster Compute Resource by Name

by Simon Sparks · 27 January 2026

To use this function add it to the class library file named vRealizeAutomation.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: vRealizeAutomation.ts

Function VCACEntityGetCluster

Description: The following code finds a vCACEntity object for a vCenter Cluster Compute Resource by Name.

publicVCACEntityGetCluster (strHostName:string):VCACEntity
{
letstrFilter:string=`HostName eq '${strHostName}' and IsCluster eq true and MachineType eq 0`;
letstrExpand:string=null;
letstrOrderBy:string=null;
letstrSelect:string=null;
letintTop:number=null;
letintSkip:number=0;
letobjPropertiesHeaders:Properties=newProperties();

letarrVCACEntityHost:VCACEntity[]=vCACEntityManager.readModelEntitiesBySystemExpandQuery(this.objVCACHost.id,"ManagementModelEntities.svc","Hosts",strFilter,strExpand,strOrderBy,strSelect,intTop,intSkip,objPropertiesHeaders);

letobjVCACEntityHost:VCACEntity=arrVCACEntityHost.find((objVCACEntity:VCACEntity):boolean=>{
returnobjVCACEntity.getProperty("HostName")===strHostName;
});

returnobjVCACEntityHost;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like