vSphere Export VMName and MacAddress

Get VMs begining with DC2-GEN-V62 and use Get-NetworkAdapter for MAC address with powershell expression
[code language=”powershell”]
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
[/code]
Just display with out export to CSV
[code language=”powershell”]
connect-viserver vsphere01
get-vm DC2-GEN-V62* | Select @{Expression={$_.Name};Label="VM Name"},@{Expression={$(Get-NetworkAdapter -VM $_.Name).MacAddress};Label="Mac Address"}
[/code]

Leave a comment

Your email address will not be published. Required fields are marked *

WordPress Appliance - Powered by TurnKey Linux