vSphere Export VMName and MacAddress

Get VMs begining with DC2-GEN-V62 and use Get-NetworkAdapter for MAC address with powershell expression

connect-viserver vsphere01
get-vm DC2-GEN-V62* | Select @{Expression={$_.Name};Label="VM Name"},@{Expression={$(Get-NetworkAdapter -VM $_.Name).MacAddress};Label="Mac Address"} | Export-csv c:\tmp\DC2-GEN-V62_MACs.csv

Just display with out export to CSV

connect-viserver vsphere01
get-vm DC2-GEN-V62* | Select @{Expression={$_.Name};Label="VM Name"},@{Expression={$(Get-NetworkAdapter -VM $_.Name).MacAddress};Label="Mac Address"}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s