Hello,
I would like to change the VC :DistributedVirtualPortgroup of a VcVirtualVmxnet3 card already created on a VM. We can consider that there’s only one NIC card on the VM.
I’ve scripted the following using the DeviceBackingInfo.
IN-paramter : VC:VirtualMachine (vm)
macAddresses = new Array();var deviceArray = vm.config.hardware.device;if (!deviceArray) throw "Error getting hardware config array of VM";System.debug("deviceArray: " + deviceArray);for (var i in deviceArray) {var currentDevice = deviceArray.pop();if (currentDevice) {if (currentDevice instanceof VcVirtualVmxnet3) {System.debug("found network card on " + currentDevice);System.debug("PortGroup " + currentDevice.backing.port.portGroupKey);}}}
Log :
[D] found network card on DynamicWrapper (Instance) : [VcVirtualVmxnet3]-[class com.vmware.vim.vi4.VirtualVmxnet3]
-- VALUE : com.vmware.vim.vi4.VirtualVmxnet3@fac8f915
[D] PortGroup : dvportgroup-42367
42367 is correct, it’s the actual dvport Id… How could I change this value on adding an in-parameter "VC:DistributedVirtualPortGroup" set with the correct DvPort.
In advance, thank you for your help.
Regards,
Fred
Take a look at this thread, it helped me when needing to change to a DV Portgroup.
Take a look at this thread, it helped me when needing to change to a DV Portgroup.
Thank you...! I've founded the answer in the package.
Regards,
Fred