Get esx host CDP info
Jump to navigation
Jump to search
Credit to LucD from the VMware forums http://communities.vmware.com/message/977487
Get-VMHost | Sort -Property Name | %{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 $hint.connectedSwitchPort.DevId $hint.connectedSwitchPort.PortId } } }
Example output:
esxserver01 vmnic1 core-switch-01 GigabitEthernet1/0/1 esxserver02 vmnic2 core-switch-02 GigabitEthernet1/0/2 esxserver03 vmnic3 core-switch-01 GigabitEthernet1/0/2 esxserver04 vmnic4 core-switch-02 GigabitEthernet1/0/1
<comments />