Listing Virtual Machines and Portgroups

vSphere 5.0 - If you need a list of Virtual Machines and the portgroups they are attached to:

1
Get-VM -Location "somewhere" | ft Name, @{Expression={$_.NetworkAdapters.NetworkName};Label="Network Name"}

If you need to export this to a CSV:

1
Get-VM -Location "somewhere" | select-object Name, @{Expression={$_.NetworkAdapters.NetworkName};Label="Network Name"} | export-csv "vm-networks.csv"
Built with Hugo
Theme Stack designed by Jimmy