VMware Cloud Community
Avishay
Contributor
Contributor

Query VCD using MAC address

Hi

Is there a way to query VCD for a VM with a specific MAC address.

Something like:

VM vm = getVMByMAC(String macAdrress);

Thanks

Avishay

0 Kudos
1 Reply
Dean_H
Contributor
Contributor

If you want to get the info from VC you can try this...

$vms =  get-vm

foreach ($vm in $vms) {

     if ((Get-NetworkAdapter $vm).MacAddress -match "XX:XX:XX:XX:XX:XX") {

          $vm | fl

     }

}

From vCloud Director:

$vms =  get-civm

foreach ($vm in $vms) {

     if ( $vm.ExtensionData.GetNetworkConnectionSection().NetworkConnection[0].MACAddress -match "XX:XX:XX:XX:XX:XX") {

     # if you have multiple nics you will need to edit the above.

          $vm | fl

     }

}

Blog: http://mypowercli.wordpress.com | Twitter: @Danger0u5
0 Kudos