Hi,
I want to change the MAC address from "Auto" to "Manual", but with the generated MAC Address from the "Auto" step.
I saw some similar workflows, but these workflows always create a new NIC and because I am not the real Java Pro, I don't know, how to just change these settings.
Help would be awesome
.
Thanks in Advance
Hi,
Here is a sample that changes MAC address type of a NIC labelled 'Network Adapter 2' from auto to manual. The input parameter is vm of type VC:VirtualMachine
var devices = vm.config.hardware.device;
for (var i in devices) {
if (!System.getModule("com.vmware.library.vc.vm.network").isSupportedNic(devices[i])) {
continue;
}
if (devices[i].deviceInfo.label != "Network adapter 2") {
continue;
}
// NIC is found -> change its MAC address type
var confSpec = new VcVirtualDeviceConfigSpec();
confSpec.operation = VcVirtualDeviceConfigSpecOperation.edit;
confSpec.device = devices[i];
confSpec.device.addressType = "manual"; // change 'manual to 'generated' if you want to change the type back to auto
var spec = new VcVirtualMachineConfigSpec();
spec.deviceChange = [confSpec];
vm.reconfigVM_Task(spec);
}
Hi,
Here is a sample that changes MAC address type of a NIC labelled 'Network Adapter 2' from auto to manual. The input parameter is vm of type VC:VirtualMachine
var devices = vm.config.hardware.device;
for (var i in devices) {
if (!System.getModule("com.vmware.library.vc.vm.network").isSupportedNic(devices[i])) {
continue;
}
if (devices[i].deviceInfo.label != "Network adapter 2") {
continue;
}
// NIC is found -> change its MAC address type
var confSpec = new VcVirtualDeviceConfigSpec();
confSpec.operation = VcVirtualDeviceConfigSpecOperation.edit;
confSpec.device = devices[i];
confSpec.device.addressType = "manual"; // change 'manual to 'generated' if you want to change the type back to auto
var spec = new VcVirtualMachineConfigSpec();
spec.deviceChange = [confSpec];
vm.reconfigVM_Task(spec);
}
That's exactly what I wanted, thanks a lot!
