Orchestrator Function: SRM Site Get

by Simon Sparks · 4 February 2026

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

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

Filename: OrchestratorPluginSRMService.ts

Public Function: SRMSiteGet

publicSRMSiteGet(objVcVirtualMachine:VcVirtualMachine):SRMSite{

letobjVcSdkConnection:VcSdkConnection=objVcVirtualMachine.sdkConnection;

letstrVcSdkConnection:string=objVcSdkConnection.toString();

letarrSRMSite:SRMSite[]=this.SRMSitesGet();

letarrSRMSiteForVcVirtualMachine:SRMSite[]=arrSRMSite.filter((objSRMSite:SRMSite):boolean=>{
returnobjSRMSite.name===strVcSdkConnection;
});

letobjSRMSiteForVcVirtualMachine:SRMSite=arrSRMSiteForVcVirtualMachine[0];

letobjSRMSite:SRMSite=null;

letarrSRMSiteByDeploymentId:SRMSite[]=null;

if (!objSRMSiteForVcVirtualMachine){

letstrVcSdkConnectionInstanceUuid:string=objVcSdkConnection.instanceUuid;

arrSRMSiteByDeploymentId=arrSRMSite.filter((objSRMSite:SRMSite):boolean=>{
returnobjSRMSite.deploymentId.startsWith(strVcSdkConnectionInstanceUuid)===true;
});

if (arrSRMSiteByDeploymentId.length>1){
thrownewGeneralError(`We found more than 1 SRM Site using the vCenter Virtual Machine InstanceUuid '${strVcSdkConnectionInstanceUuid}'.`);
}

if (arrSRMSiteByDeploymentId.length===0){
thrownewGeneralError(`We cannot found SRM Site using the vCenter Virtual Machine InstanceUuid '${strVcSdkConnectionInstanceUuid}'.`);
}

objSRMSite=arrSRMSiteByDeploymentId[0];
}else{
objSRMSite=objSRMSiteForVcVirtualMachine;
}

if (!objSRMSite){
thrownewGeneralError(`Cannot find SRM Site for VM '${objVcVirtualMachine.name}'. Make sure that all vCenter, SRM and Replication plugins are configured.`);
}

returnobjSRMSite;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like