VMware {code} Community
DeepakMishra
Contributor
Contributor
Jump to solution

How to get MAC Address of virtual machine on which vmware tool is not installed

Hi,

In our project we communicate to vCenter/ESX and get the details of virtual machines using Java API of VI SDK 4.0.0

To get the detail I am using PropertyCollector.

But in following cases

1. A virtual machine is poweredOff.

2. VMware tool is not installed on the Virtual machine.

I am not able to get the mac address using the PropertyColector.

To get the macaddress property I use following traversal spec:

rootFolder (Folder) --> childEntity(dataCenter) --> hostFolder(Folder) --> childEntity(ComputerResource)

--> host(Hostsystem) --> vm(Virtualmachine) --> guest(GuestInfo) --> net(GuestNicInfo) --> macaddress

I know the vSphere client uses the VI SDK to perform all the opeations, and I am able to see the macAddress of VirtualMachine in either of the cases using vSphere client.

Can any body please help me in getting the macaddress of virtual machine in the above two cases.

Thank you,

deepak

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

Take a look at the VM's device array and specifically the "VirtualEthernetCard": http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.vm.device.VirtualEthe...

When you assign a new vNIC to each VM, a uniquely generated MAC address is given by default. If you want to further map the actual interface from the guestOS, then you would take a look at guestInfo as you've noted IF you have VMware Tools. Though by default, this is where the MAC Address is coming from

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
1 Reply
lamw
Community Manager
Community Manager
Jump to solution

Take a look at the VM's device array and specifically the "VirtualEthernetCard": http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.vm.device.VirtualEthe...

When you assign a new vNIC to each VM, a uniquely generated MAC address is given by default. If you want to further map the actual interface from the guestOS, then you would take a look at guestInfo as you've noted IF you have VMware Tools. Though by default, this is where the MAC Address is coming from

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos