Get esx host CDP info: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 27: | Line 27: | ||
[[Category:powercli]] | [[Category:powercli]] | ||
[[Category:scripts]] | [[Category:scripts]] | ||
<comments /> |
Latest revision as of 09:04, 20 March 2022
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 />