Get esx host CDP info: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Credit to LucD from the VMware forums http://communities.vmware.com/message/977487 <pre> Get-VMHost | Sort -Property Name | %{Get-View $_.ID} | %{$esxname = $_.Name; Get-View...") |
No edit summary |
||
Line 21: | Line 21: | ||
</pre> | </pre> | ||
[[Category:vmware]] | |||
[[Category:vsphere]] | |||
[[Category:esxi]] | |||
[[Category:powercli]] | |||
[[Category:scripts]] |
Revision as of 09:20, 29 August 2019
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