Skip to content

Instantly share code, notes, and snippets.

@michaelrice
Created August 5, 2014 20:46
Show Gist options
  • Save michaelrice/32668d4e5f432d06897d to your computer and use it in GitHub Desktop.
Save michaelrice/32668d4e5f432d06897d to your computer and use it in GitHub Desktop.
// Create the updated device spec
VirtualDeviceConfigSpec nicSpec = new VirtualDeviceConfigSpec()
nicSpec.device = nic
nicSpec.operation = VirtualDeviceConfigSpecOperation.edit
// Create the VM update spec
VirtualMachineConfigSpec spec = new VirtualMachineConfigSpec()
spec.deviceChange = [nicSpec]
// Do the update
try {
Task task = virtualMachine.reconfigVM_Task(spec)
// Wait for it to complete
task.waitForMe()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment