.NET Example of Powering On a Virtual Machine

This example is based on the code in the EthernetConfiguration.cs sample file.

Note: For a complete and up-to-date version of the sample code, see the vSphere Automation SDK .NET samples at GitHub.
...
   private string vmId;
   private Power powerService;
   public string VmName { get; set; }
		
...
		
      this.powerService = VapiAuthHelper.StubFactory.CreateStub<Power>(
          SessionStubConfiguration);
			
...
		
      this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory,
          SessionStubConfiguration, VmName);
			
...
		
      this.powerService.Start(this.vmId);
...