Orchestrator Function: VcHostSystemServiceStop

by Simon Sparks · January 5, 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

private VcHostSystemServiceStop(objVcHostSystem: VcHostSystem, strServiceName: string): void {

    let objVcHostConfigManager: VcHostConfigManager = objVcHostSystem.configManager;

    let objVcHostServiceSystem: VcHostServiceSystem = objVcHostConfigManager.serviceSystem;

    let objVcHostServiceInfo: VcHostServiceInfo = objVcHostServiceSystem.serviceInfo;

    let arrVcHostService: VcHostService[] = objVcHostServiceInfo.service;

    let objVcHostService: VcHostService = arrVcHostService.find((objVcHostService: VcHostService): boolean => {
        return objVcHostService.key === strServiceName;
    });

    this.objLogger.info(`Attempting to Start Service on host: '${objVcHostSystem.name}'...`);

    if (objVcHostService.policy != "off") {
        objVcHostServiceSystem.updateServicePolicy(strServiceName, "on");
    }

    if (objVcHostService.running == true) {
        objVcHostServiceSystem.startService(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.

You may also like