Configuring a Virtual Machine

You can configure a virtual machine during creation (
Folder.CreateVM_Task
) or cloning (
VirtualMachine.CloneVM_Task
). You can also reconfigure a virtual machine using
VirtualMachine.ReconfigVM_Task
. However, do not use the
VirtualMachine.ReconfigVM_Task
call to create or add a disk.
In vSphere 5.5 and later, the
ReconfigVM_Task
method will throw an error when it attempts to change certain virtual machine properties while the virtual machine is powered on. In previous releases, the server would modify the properties in the configuration specification and the changes would take effect after the virtual machine resets, reboots, or performs a fast suspend and resume.
Since vSphere 5.5, a reconfigure operation modifies the virtual machine in real time, so that the virtual machine properties have been changed by the time the method returns control to the client.
You cannot reconfigure a virtual machine successfully if you specify any of the following properties in the
VirtualMachineConfigSpec
when you call the
ReconfigVM_Task
method.
Property
VirtualMachineConfigSpec Path
VirtualDevice.unitNumber
deviceChange.device.unitNumber
VirtualDevicePciBuslSlotInfo.pciSlotNumber
deviceChange.device.slotInfo.pciSlotNumber
VirtualDiskFlatVer1BackingInfo.diskMode
VirtualDiskFlatVer2BackingInfo.diskMode
VirtualDiskRawDiskMappingVer1BackingInfo.diskMode
VirtualDiskSeSparseBackingInfo.diskMode
VirtualDiskSparseVer1BackingInfo.diskMode
VirtualDiskSparseVer2BackingInfo.diskMode
deviceChange.device.backing.diskMode
VirtualDiskFlatVer2BackingInfo.digestEnabled
VirtualDiskSeSparseBackingInfo.digestEnabled
deviceChange.device.backing.digestEnabled
VirtualMachineConfigSpec.changeTrackingEnabled
changeTrackingEnabled
VirtualEthernetCard.addressType
deviceChange.device.addressType
VirtualEthernetCard.macAddress
deviceChange.device.macAddress
VirtualEthernetCard.wakeOnLanEnabled
deviceChange.device.wakeOnLanEnabled
VirtualSCSIController.sharedBus
deviceChange.device.sharedBus
VirtualSerialPort.yieldOnPoll
deviceChange.device.yieldOnPoll
VirtualUSBController.autoConnectDevices
VirtualUSBXHCIController.autoConnectDevices
deviceChange.device.autoConnectDevices
VirtualUSBController.ehciEnabled
deviceChange.device.ehciEnabled
VirtualMachineVideoCard.useAutoDetect
deviceChange.device.useAutoDetect
VirtualMachineVideoCard.videoRamSizeInKB
deviceChange.device.videoRamSizeInKB
VirtualMachineVideoCard.numDisplays
deviceChange.device.numDisplays
VirtualMachineVideoCard.use3dRendererSupported
deviceChange.device.use3dRendererSupported
The
API Reference
lists all properties and includes information about required permissions for these configuration methods. The following sections describe some commonly specified attributes.