Grabbing MAC-Addresses VM’s on a specific host
How can I retrieve the MAC address from a VMhost using PowerCLI?
This simple oneliner shows you how
Get-VMHost <vmhost>|get-vm|select Name,` @{N="Mac";E={($_.networkadapters|%{$_.macaddress})}}
IT stuff
How can I retrieve the MAC address from a VMhost using PowerCLI?
This simple oneliner shows you how
Get-VMHost <vmhost>|get-vm|select Name,` @{N="Mac";E={($_.networkadapters|%{$_.macaddress})}}
Because I needed to create multiple VM’s from a template I decided to have a look into the PowerCLI command for this. I created a text file with pre-given names, called D:<file>.txt, for each item in this list I create a new VM according to template <template> on <vmhost> and <datastore>. To put the VM’s in a specific location I use the “-location”. With the option “RunAsync” it fires the commands and goes to the next one instead of waiting for the first job to complete before proceeding to the next one.
foreach ($vm in (GC D:<file>.txt)){ New-VM -name $vm -Location <location> -Template <template>` -vmhost <vmhost> -Datastore <datastore> -RunAsync }