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

Hello

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

I use PropertyCollector for details.

But in the 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 using the PropertyColector address.

To get the macaddress property I use after crossing spec:

rootFolder (folder)-> childEntity (data center)-> hostFolder (Folder)-> childEntity (ComputerResource)

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

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

Is any body please help me get the macaddress of VM in the two cases.

Thank you

Deepak

Take a look at the dashboard feature of the virtual machine and specifically "VirtualEthernetCard": http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.vm.device.VirtualEthernetCard.html

When you assign a new vNIC to each virtual machine, a unique MAC address generated is given by default. If you still want to map the actual interface of the guestOS, then you would take a look at guestInfo as you may have noticed IF you have the VMware Tools. Although the default is whence the MAC address

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

William Lam

VMware vExpert 2009

Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

Twitter: @lamw

repository scripts vGhetto

Introduction to the vMA (tips/tricks)

Getting started with vSphere SDK for Perl

VMware Code Central - Scripts/code samples for developers and administrators

150 VMware developer

If you find this information useful, please give points to "correct" or "useful".

Tags: VMware

Similar Questions

  • How to get address Virtual Machine MAC on which vmware tools is not installed

    Hello

    I'm putting the MAC address of a virtual machine in a string. At first, I was using this script:

    strMACAddress = objVM.guest.net [0] .macAddress;

    But as indicated in the title, the vmware tools are not installed on the virtual machine. I found a similar position in vSphere Web Services SDK:

    http://communities.VMware.com/thread/254204

    In this post, it is specified to use the script VcVirtualEthernetCard() object. I'm new to Orchestrator and I do not understand how to make a "myVcVirtualEthernetCard" link to my virtual computer object 'objVM '.

    Example:

    IN: objVM (VcVirtualMachine)

    OUT: macAddress

    var myVcVirtualEthernetCard = new VcVirtualEthernetCard();

    macAddress var = myVcVirtualEthernetCard.macAddress;

    Thank you for your help.

    Kind regards

    Fred

    Hello!

    You can browse the table config.hardware.device of the virtual machine:

    IN: vm (Vc:VirtualMachine)

    DEPARTURES: Macaddresses (Array/string)

    //initialize macAddresses array (to make a push() possible later)
    macAddresses = new Array();
    var deviceArray = vm.config.hardware.device;
    if (!deviceArray) throw "Error getting hardware config array of VM";
        System.debug("deviceArray: " + deviceArray);
    //loop through array, find NICs and retrieve there MACs
    for (var i in deviceArray) {
        var currentDevice = deviceArray.pop();
        if (currentDevice) {
            System.debug("currentDevice: " + currentDevice);
            if (currentDevice instanceof VcVirtualE1000 ||
                currentDevice instanceof VcVirtualPCNet32 ||
                currentDevice instanceof VcVirtualVmxnet ||
                currentDevice instanceof VcVirtualVmxnet2 ||
                currentDevice instanceof VcVirtualVmxnet) {
                    System.debug("found network card on " + currentDevice);
                    macAddresses.push(currentDevice.macAddress) ;
            }
        }
    }
    

    Please let me know if it works for you, or if you need more information :-)

    Kind regards

    Joerg

  • How to move the virtual machine from one cluster to another cluster

    How to move the virtual machine from one cluster to another cluster

    If two Clusters are in the same data center, you could do a 'live' migration or vMotion, if that's the case.   If the virtual machine is turned off, it may be migrated regardless of the data center.

  • How to make the virtual machine in 64-bit with VMware6.5

    My CPU: AMD Turion 64 * 2

    Operating system: Windows xp 32

    Question:

    I want to run Open solaris 2008 which is 64 bit, I did a virtual machine but it is 32-bit. You tell me how to make the virtual machine in 64 bits in VMware6.5, I really appreciate.

    Yes.  Power off the virtual computer.  Change the settings.  Change the guest OS to Solaris 10 to Solaris 10 64-bit.

  • How to get the Mac address of a virtual machine?

    Hello world...

    I need help to get the MAC address of a virtual computer, I'm stuck in it.

    Please reply if anyone know solutions.

    Thank you

    Mahesh Thawari

    Here's a vSphere SDK for Perl script that extracts the MAC addresses for all your virtual machines - http://communities.vmware.com/docs/DOC-10490

    You should be able to take it and translate it into any language vSphere SDK you plan to use. Basically you'll be listing through virtual hardware for the virtual machine to search for devices of type VirtualEthernetCard and then retrieve the MAC address of each device.

  • Is it possible to programmatically retrieve the MAC address of a virtual machine VMware

    Can anyone suggest to programmatically retrieve the MAC address of a VMware virtual machine.

    I need a code for the above features.

    Post edited by: AntonVZhbankov

    Corrected in Hyper-V to VMware

    Now that I have a code in front of me, you can try essentially this:

    
    // MAC Variable
    string MACAddress;
    
    // Get Config Info (hardware)
    vmConfigInfo = (VirtualMachineConfigInfo)myAPI.getProperties(vmRef, new String[1] {"config"});
    
    //Iterate through devices
    foreach (VirtualDevice vDv in vmConfigInfo.hardware.device)
    {
        try
        {
            VirtualEthernetCard mycard = (VirtualEthernetCard)vDv;
            MACAddress = mycard.macAddress;
        }
        catch
        {
        }
    }
    

    Basically what's happening hear, you are pulling all the pieces of virtual hardware and iterate through them. If the piece is a network card, copy the following code will be able to cast an and pull up on the Mac. Otherwise, the cast fails and he is going to move. If you have multiple network cards, you want to add the mac to an array of strings, or something to keep account of more than one.

    This code assumes that you have connected and you have a way to make the configuration of the virtual machine property. The function 'getProperty' in the present code referring to my own function, not one in VMWare. If you don't know how to do this, just post back here and I know there are examples of pages out there anyone can post to explain this part.

  • Question about how to include the virtual machine output

    Currently, using this command:

    Get - vm | Get-networkadapter | ForEach-Object {Write-Host $_.} The name', ' {$_.macaddress} '.

    Gives me this result:

    NIC 1, 00:50:56:bc:00:1 c

    NIC 1, 00:50:56:bc:00:28

    I'm interested also in writing the name of real virtual machine as well.

    name of the virtual machine 1, NIC 1, 00:50:56:bc:00:1 c
    name of the virtual machine 1, NIC 1, 00:50:56:bc:00:28

    Don't know how to work out of virtual machine name as 'Name' asks also the network card information.

    Try it like this

    $report = foreach($vm in (Get-VM | where {$_.PowerState -eq "PoweredOn" -and $_.Version -eq "v7"})){
        Get-NetworkAdapter -VM $vm  | `    Select @{N="VMname";E={$vm.Name}},
             @{N="MAC address";E={$_.MacAddress}}
    }
    
    $report | Export-Csv ".\test.csv" -NoTypeInformation -UseCulture
    
  • How to move the Virtual Machine VMWare Workstation 10 to a completely different computer

    I have a laptop that is going to become my 'old' laptop, I bought and am always set up a new computer.

    I have a VM THAT evolution created on the 'old' portable using VMWare Workstation 10.  I installed the software VMWare Workstation 10 on the new laptop computer and am ready to move to the existing VM development since the old laptop again to continue the development of software on the virtual machine to the new machine.

    I never moved a computer virtual from one computer to another, and I guess that all I have to do is to copy and move the folder and all its content from the old laptop to the new, and then I'll be back in business?

    Just make sure it is this simple before doing so.

    Thanks for any input.

    It's as simple as that. When you start in the new machine, it should ask if you copied or moved. Answer that you moved it will keep the same MAC address and you will not be able to connect the two copies at the same time. You copied it saying assigns a new MAC and they both can connect, but a Windows machine can ask to reactivate. Seems to me he asked also to reactivate when I copied it for an Intel system AMD system, but it was a long time ago

    Lou

  • How to access the virtual machines to different physical network?

    Hello

    I'm new to ESXi, can someone tell me how can I access virtual machines on the physical network existing in case I use different IP classes? Physics of the network by using the class C IPs and I assigned IPs to virtual machines of class A? If it is possible, then, what are the steps?

    In fact, I installed exchange 2010 VMs and also want to access the email accounts of physical network.

    Thank you.

    vmjunki wrote:

    You mean there's no way in ESXi to configure the way so we can access the virtual machines to physical network? without third-party applications.

    Because it is impossible for the various networks IP connect without a router, you must have such a device. There is really no difference in that in a pure virtual or physical environment.

    You might think the ESXi host as a box with one or more servers (virtual) inside and one or more layer (virtual) two switches, just like a small server room. This means you will need to provide the same type of connectivity that you would have to a new server room with machines configured with addresses in a different IP network range.

  • [Beginner] How to change the virtual machine name

    Hello

    How can I change the name of a Virtual Machine - I want to say the name that appears in VMPlayer (or VMWare Fusion) as it has recently used Virtual Machines. I tried to change the name of the vmx file but this does not affect the name of the virtual machine displayed in VMPlayer.

    Thank you very much.

    TomasBar wrote:

    How can I change the name of a Virtual Machine - I want to say the name that appears in VMPlayer (or VMWare Fusion) as it has recently used Virtual Machines.

    VMware Fusion 3.x and 2.x but not 1.x, you can click on and change the name of the virtual machine in the Virtual Machine library on the right side, just under the display area.

    For VMware Player you need to edit the "displayName ="parameter in the configuration file .vmx and of VMware Player virtual machine must be closed when you perform this operation."

  • How to create the virtual machine to a virtual machine existed file?

    I have two hard drives on my VMware host. There are virtual machines on a SATA drive, how do I list these files of virtual machines and copy one of them to create a new virtual machine (it can save a lot of my time!). I did this way on VMware server 2.0 because I can see what they were and where they were under Windows. But on vSphere, how can I do? Maybe you guys have other ways to do it?

    Thank you!

    George

    On vSphere, I suggest you use autonomous vConventer instead. It is quite simple and easy to use. Alternatively, you can copy or clone the virtual disk to the virtual machine via the Console (ESX) Service offline

    vcbMC - 1.0.6 Beta

    Lite vcbMC - 1.0.7

    http://www.no-x.org

  • Monitoring VM - how to restart the virtual machine

    Hi all

    Hit a problem in our environment that can not be solved, but wanted to tender hand to people and see if they have found a way to replace.

    Currently have followed vm enabled in our cluster. Thing is watching us to restart the virtual machine VMware tools demonstrated to a status of "not running" - now, the key is to most of the definitions, the system is available in this case, can be crazy, RDP'ed etc, but we here again them restarted as he finally solves the issue we see (for example unable to connect via citrix for the machines in question)

    Duncan in the post below highlights in order to avoid false positives any i/o to storage/network activity will be verified after that heatbeats failed to "double check" there is a problem with the virtual machine

    Favorite VM monitoring (aka VM HA) - yellow bricks

    What I asked is it possible to replace verification of network storage/IO activity and then restart the virtual machine VMware tools on them stops as soon as?

    Many tx for all thoughts

    «.. . is there a way to replace check network activity of storage/IO and then restart the virtual machine of VMware tools on them stops as soon as...? »

    You can always use a supervision-process inside the virtual machine for this tool (perhaps more followed VM). It acts independently and allows much finer control, i.e. it can try first (re) start vm-tools before restarting. Same BSOD /-kernel panic can be dealt with by VM itself. It can actually be even more robust, not dependent on VMware infrastructure.

  • How to move the virtual machine from one host to another?

    The two boxes under ESXi 5.0 (hypervisors freely licensed).

    I have a virtual machine (FreeBSD) that I need to go to another box.

    Network ports are not the same, but I guess that's not a biggie to reconfigure the network cards. Other than that, I have to follow a few best practices/SOPS or copy & paste is everything I need to run perfectly on a different host?

    Thank you very much!

    FastSCP allows you to copy directly between hosts, so it can save a lot of time you copy.  I don't know what you mean by 'manually' copy files.  Do you mean using the vShpere client and download the files to a location then download them to the new host?  Either way works perfectly, but FastSCP you must save a step.

    If you have currently snapshots, you can consolidate first or leave em and just copy them with the rest of the virtual machine. There should be no need to do something with snapshots, if you perform a migration 'offline '.  As long as you take all the files, snapshots will be displayed on the destination host computer when you save the vm on the host.

    I did 'on-line' migration of large virtual machines first to the take a snapshot on the source host, copy basic to the first destination host disks while the virtual machine was still running on the source host.  When I was ready to migrate the CPU processing, I power off the virtual machine, copy the other files (which would include the deltas from disk and whatnot) and turn on the vm on the destination host (which would cause only a few minutes of downtime).  Later, I consolidate records by removing the snapshot on the destination host.  Way to a poor man to do a migration of vm on ESXi free edition with little downtime.

  • How to configure the virtual machine for the changes to forget

    Hi, I want to ask if it is possible together in the virtual machine for the changes to forget. For example - user run VM... make some changes in the configuration. Then come a new user has it want to have clear (without changes in the configuration) virtual machine. Is possible together closed the machine after changes lost?

    Sorry for my English.

    Thanks for help.

    Hi Polo939

    First, you will need to take a snapshot of the virtual machine.

    • Select your virtual machine

    • Click on "take a snapshot" on the right-hand side of the web interface

    Then you must configure the virtual machine to go back to the snapshot when it is turned off.

    • Click on "configure the VM.

    • Click the "snapshot".

    • Select "back to overview" under when you feed off option

  • Start the virtual machine and wait for WF, does not connect to the computer virtual for Vds (Windows 2008 R2)

    Hello

    See a strange problem with only a Windows 2008 R2 model. When you use the built-in function "Start VM and wait" workflow to start a virtual machine (after conversion from a template either manually, or through workflow) NIC of the virtual machine (I tried VMXNET3 and e1000 times) does not connect to the problem. Vds can be replicated in a different VCenter, so spreading the vds. I also created several models of Windows 2008 r2 and all have this problem.

    If the model is converted and started outside VRO, it gets an IP from and is connected to the VDS immediately

    Tried add/remove the NIC of the model

    Tried to move the comments on different hosts

    Tried to create a new template from scratch

    NOTE: Windows 2012 R2 doesn't have this problem in the same circles, the only constant is the Windows 2008 R2 being started by VRO.

    Anyone seen this before?

    I found this article and it fixed my problem VMware KB: registration or the deployment of a virtual computer model fails apparently a fix a problem in ESX 5.1, 5.5 (I used the option to get around and things are good)

Maybe you are looking for