Orchestrator Function: vCenter Cluster Compute Resource Rescan Storage

by Simon Sparks · 5 January 2026

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

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

Filename: vCenterServerService.ts

Public Function: VcClusterComputeResourceRescanStorage

publicVcClusterComputeResourceRescanStorage(objVcClusterComputeResource:VcClusterComputeResource):void{
this.objLogger.info(`Start rescanning storage for cluster${objVcClusterComputeResource.name}.`);

try{
letarrVcHostSystem:VcHostSystem[]=objVcClusterComputeResource.host;

this.objLogger.debug(`Number of hosts to be rescanned${arrVcHostSystem.length}`);

arrVcHostSystem.forEach((objVcHostSystem:VcHostSystem):void=>{

letobjVcHostConfigManager:VcHostConfigManager=objVcHostSystem.configManager;

letobjVcHostStorageSystem:VcHostStorageSystem=objVcHostConfigManager.storageSystem;
objVcHostStorageSystem.rescanAllHba();
objVcHostStorageSystem.rescanVmfs();
objVcHostStorageSystem.refreshStorageSystem();

this.objLogger.debug(`Rescan finished for host${objVcHostSystem.name}`);
});
}
catch (objException){

Utilities.logException(objException,this.objLogger,"VcClusterComputeResourceRescanStorage",`Rescan failed for${objVcClusterComputeResource.name} cluster.`);

}
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like