Dear All,
I have created 4 virtual nics with 4 different Ips, Now I required which network adapter card has which Ip mapped to it individualy.
my requirement is i nedd to add diiferent port group for each network addpater based on the IP address which i passed while cloneing the VM from template.
I do not have the control to pass Ip on the to particular NIC while cloneing .
I wanted to get the list of network adapter with Ip attached to my vm.
Is it possible to add a virtual nic with specific Ip.
Please help me.
Thanks In advance.
Yes this is possible, you would need to iterate through the vNIC's that's been added to a given VM and extract out the necessary bits of information. To obtain the IP Address, you will need to ensure the VM is up and running VMware Tools, else you will not be able to extract that information.
You can extract both the IP info + portgroup by taking a look at the guestInfo property which is only exposed if you have VMware Tools running: http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.GuestInfo.html
If you don't have VMware Tools running but would like to view the vNICs, then you can take a look at the VM's virtual hardware device array and extract out only the devices that is of type VirtualEthernetCard - http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.VirtualHardware.html
Here are a few vSphere SDK for Perl examples that you can leverage to build a script that extracts what you need:
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Yes this is possible, you would need to iterate through the vNIC's that's been added to a given VM and extract out the necessary bits of information. To obtain the IP Address, you will need to ensure the VM is up and running VMware Tools, else you will not be able to extract that information.
You can extract both the IP info + portgroup by taking a look at the guestInfo property which is only exposed if you have VMware Tools running: http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.GuestInfo.html
If you don't have VMware Tools running but would like to view the vNICs, then you can take a look at the VM's virtual hardware device array and extract out only the devices that is of type VirtualEthernetCard - http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.VirtualHardware.html
Here are a few vSphere SDK for Perl examples that you can leverage to build a script that extracts what you need:
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Thanks William..
It really works.
Mahesh Thawari