VMware Aria Automation Orchestrator

 View Only
  • 1.  Enabling SSH on an ESXi host which is NOT a member in any vCenter - PowerCLI issues / consideration

    Posted Jan 13, 2023 08:21 AM

    Hello together

    We have a "2-stage" problem, so to speak:

     

    1. How can you enable SSH on an ESXi host if this host is not (yet) a member of a vCenter? The only solution we found is that we use PowerCLI instead of JavaScript inside vRO. Are there alternative options?

    2. If we stick with PowerCLI, we would like to build some single, reusable actions. E.g. a PowerCLI action to enable SSH, another PowerCLI action that does some specific things, and a PowerCLI action that disables SSH.
      However, now we are wondering, if one PowerCli Action eanables SSH and then terminates, how can I "tell" the next PowerCLI Action that the previous PowerCLI Action has already logged-in on to the ESXi host? Somehow you have to be able to pass on these login credentials from one action to the next, right?

    Please excuse my english, it's not my native language.

    Kind regards
    Roman



  • 2.  RE: Enabling SSH on an ESXi host which is NOT a member in any vCenter - PowerCLI issues / consideration

    Posted Jan 17, 2023 08:31 PM

    I can't find other methods so I guess you have to go with powercli.

    You can't reuse the session of a previous action, as each action will run in its own container, separated from others. You have to authenticate in each action.



  • 3.  RE: Enabling SSH on an ESXi host which is NOT a member in any vCenter - PowerCLI issues / consideration

    Broadcom Employee
    Posted Jan 04, 2026 01:49 PM

    I have created a solution for this in TypeScript using the Aria Build Tools

    https://github.com/vmware/build-tools-for-vmware-aria

        private VcHostSystemServiceStart(@notNull @notEmpty @required objVcHostSystem: VcHostSystem, @notNull @notEmpty @required 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}'. `);
        }
    
        private VcHostSystemServiceStop(@notNull @notEmpty @required objVcHostSystem: VcHostSystem, @notNull @notEmpty @required 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}'. `);
        }
    
        private VcHostSystemServiceRestart(@notNull @notEmpty @required objVcHostSystem: VcHostSystem, @notNull @notEmpty @required 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 Restart Service on host: '${objVcHostSystem.name}'...`);
    
            if (objVcHostService.running == true) {
                objVcHostServiceSystem.restartService(strServiceName);
            }
    
            this.objLogger.info(`Succesfully Restart Service on host: '${objVcHostSystem.name}'. `);
        }
    


    ------------------------------
    Simon Sparks
    Automation & Orchestration Consultant
    North West England, UK, Europe
    Broadcom Employee
    ------------------------------