To use this function add it to the class library file named vCenterServerService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: vCenterServerService.ts
Function: VcHostSystemServiceStop
privateVcHostSystemServiceStop(objVcHostSystem:VcHostSystem,strServiceName:string):void{
letobjVcHostConfigManager:VcHostConfigManager=objVcHostSystem.configManager;
letobjVcHostServiceSystem:VcHostServiceSystem=objVcHostConfigManager.serviceSystem;
letobjVcHostService:VcHostService=this.VcHostServiceFindByName(objVcHostServiceSystem,strServiceName);
this.objLogger.info(`Attempting to Start Service on host: '${objVcHostSystem.name}'...`);
if (objVcHostService.policy==="on"){
objVcHostServiceSystem.updateServicePolicy(strServiceName,"off");
}
if (objVcHostService.running===true){
objVcHostServiceSystem.stopService(strServiceName);
}
this.objLogger.info(`Succesfully Start Service on host: '${objVcHostSystem.name}'.`);
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
