I'm working on some automation scripting and need to be able to get/set the "connect at power on" setting of the network adapter of a newly cloned vm. I am new to the SDK. Can someone point me in the right direction?
Thanks,
Matt
See the 'startConnected' property of VirtualDeviceConnectInfo:
The VM devices can be read from VirtualMachine.config -> VirtualMachineConfigInfo.hardware -> VirtualHardware.devices.
One or more of those VirtualDevice objects will be of a subtype of type VirtualEthernetCard. The 'connectable' property points to the VirtualDeviceConnectInfo.
I worked on my solution last night and finally found some code examples that got me going in the right direction. I solved the problem in this question but it didn't fix my issue. After cloning a template, the VM's NIC is not connected, and attempting to select "Connect at power on" from the GUI or from my first program threw an error.
What I ended up doing was removing then re-adding the NIC. I'm using the RbVmomi Ruby library for this and here's the link to a snippet of the code I used to do this.
https://gist.github.com/4235695
Thanks,
Matt