VMware {code} Community
SalamiArmy
Contributor
Contributor

How to start a VM?

Good morning everybody!

Really quick simple question, strange that I can't find any info elsewhere, but here goes: How do I start a virtual machine using the web API? I know my VMWare hypervisor web address, what web address do I call to make it startup an existing virtual machine? So far I've tried http://machinehost/sdk and http://machinehost:8333/sdk but my browser just ends up prompting me that the security certificate for that address has expired and then if I continue it takes me to a blank page.

Is the web API what I think it is? I believe that it is a REST API for developers to interface with VMWare hypervisors. If not could someone please direct me to the proper knowledge resources for VMWare RESTful APIs.

Thanks, cheers.

Reply
0 Kudos
1 Reply
joshames
Enthusiast
Enthusiast

Where to start....well you need to login to vSphere.  Maybe the code below will get you started...it's in c#.

VimClient vSphere = new VimClientImpl();

vSphere.Connect("https://vSpheremachinename/sdk");

vSphere.Login(username, password);

Once you are logged in, you can query a vm with either findentityviews or getview if you know the MOREF.

After you have a vm object you can use: VirtualMachine.PowerONVM_Task();

Hope this helps,

Josh

Reply
0 Kudos