im trying to retrive the MacAdress of a VM as String. Lets say i have a virtual machine with only one vmxnet3 nic. As Input i select vc:virtualmachine.
How do i get the mac adress of that one nic?
There must be a simple way or ?
Hi,
I use this little script to get the MAC of my newly created VMs.
newVMObject is my vc:virtualmachine Input
var deviceArray = newVMObject.config.hardware.device;
if (!deviceArray) throw "Error getting hardware config array of VM";
for (var i in deviceArray) {
var currentDevice = deviceArray.pop();
if (currentDevice) {
if (currentDevice instanceof VcVirtualE1000 ||
currentDevice instanceof VcVirtualPCNet32 ||
currentDevice instanceof VcVirtualVmxnet ||
currentDevice instanceof VcVirtualVmxnet2 ||
currentDevice instanceof VcVirtualVmxnet3 ||
currentDevice instanceof VcVirtualVmxnet) {
var mac = currentDevice.macAddress;
}
}
}
Tim
Hi,
I use this little script to get the MAC of my newly created VMs.
newVMObject is my vc:virtualmachine Input
var deviceArray = newVMObject.config.hardware.device;
if (!deviceArray) throw "Error getting hardware config array of VM";
for (var i in deviceArray) {
var currentDevice = deviceArray.pop();
if (currentDevice) {
if (currentDevice instanceof VcVirtualE1000 ||
currentDevice instanceof VcVirtualPCNet32 ||
currentDevice instanceof VcVirtualVmxnet ||
currentDevice instanceof VcVirtualVmxnet2 ||
currentDevice instanceof VcVirtualVmxnet3 ||
currentDevice instanceof VcVirtualVmxnet) {
var mac = currentDevice.macAddress;
}
}
}
Tim