Hi,
if CDP is enabled the networkswitches gives some informations to the ESXi Hosts physical network adapters.
Here are the steps to retrive these by PowerCli.
1 | PS D:\> $oVMHost = Get-VMHost -Name myESXiHost.myDomain.org |
Get the networkview of the host
1 | PS D:\> $oViewNetSystem = Get-View $oVMHost .ExtensionData.ConfigManager.NetworkSystem |
Query the infos for each (physical) LAN adapter on a host. Show only if data are available
1 2 3 4 5 6 7 8 9 | PS D:\> Get-VMHostNetworkAdapter -VMhost $oVMHost -Physical | % { $CDPData = $oViewNetSystem .QueryNetworkHint( $_ .Name) if ( $CDPData .ConnectedSwitchPort) { write-host -ForegroundColor Green ( "Host: {0} CDP Data for {1}" -f $oVMHost .Name, $_ .Name ) $CDPData .ConnectedSwitchPort | fl * $CDPData .ConnectedSwitchPort.DeviceCapability | fl * } } |
Michael