Java Example of Powering On a Virtual Machine
This example is based on the code in the EthernetConfiguration.java sample file.
Note: For a complete and
up-to-date version of the sample code, see the
vSphere
Automation SDK Java samples at GitHub.
... private String vmName; private String vmId; private Power powerService; ... this.powerService = vapiAuthHelper.getStubFactory().createStub( Power.class, this.sessionStubConfig); this.vmId = VmHelper.getVM(vapiAuthHelper.getStubFactory(), sessionStubConfig, vmName); this.powerService.start(this.vmId); ...