VMware Powercli: Get CDP infos for the Hosts Networkadapter


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.

PS D:\> $oVMHost = Get-VMHost -Name myESXiHost.myDomain.org

Get the networkview of the host

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

PS D:\> Get-VMHostNetworkAdapter -VMhost  $oVMHost -Physical | % { 
         write-host  -ForegroundColor Green ("Host: {0} CDP Data for {1}" -f $oVMHost.Name,$_.Name )
         $CDPData.ConnectedSwitchPort | fl *
         $CDPData.ConnectedSwitchPort.DeviceCapability | fl *


Advertisment to support michlstechblog.info

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.