How easy would it be to get the below codes output to a spreadsheet. Ideally each column be the name of the ESXi Host and under those columns are the returned results.
Get-VMHost | Where-Object {$_.State -eq "Connected"} | %{Get-View $_.ID} | %{$esxname = $_.Name; Get-View $_.ConfigManager.NetworkSystem} | %{ foreach($physnic in $_.NetworkInfo.Pnic){ $pnicInfo = $_.QueryNetworkHint($physnic.Device) foreach($hint in $pnicInfo){ Write-Host $esxname $physnic.Device if( $hint.ConnectedSwitchPort ) { $hint.ConnectedSwitchPort } else { Write-Host "No CDP information available."; Write-Host } } } }
code found in http://kb.vmware.com/kb/1003885