VMware Cloud Community
Narayanan_5245
Enthusiast
Enthusiast

ESXi host CDP information with Network uplink Status

Hi

Can you please help to suggest a PowerCLI Script to pull the report of ESXi host CDP information along with network uplink status for Cluster or vCenter server.

Referred the

Thank you

Regards

Narayanan.

6 Replies
LucD
Leadership
Leadership

0 Kudos
Narayanan_5245
Enthusiast
Enthusiast

Thank you LuCD for checking.

Tried the below function script but didn't have the respective vmnic Link Status (Up or Down) along with CDP information. Please advise.

Regards

Narayanan.

0 Kudos
LucD
Leadership
Leadership

You really should try searching this community, then you could find Solved: ESX host per-vSwitch NIC status report ... |VMware Communities

Combine those two scripts


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Narayanan_5245
Enthusiast
Enthusiast

Do you mean that we need to run the Get-uplink.ps1 function first along with the below script or add as last part in the existing Get-uplink script function.

Not able to understand how to combine. Can you please help to guide me as this required for whole vCenter or Cluster? Thanks.

$esxName = 'MyEsx'

Get-View -ViewType HostSystem -Filter @{Name = $esxName } -PipelineVariable esx |

ForEach-Object -Process {

    $netSys = Get-View -Id $esx.ConfigManager.NetworkSystem

    foreach ($vss in $netSys.NetworkInfo.Vswitch) {

        foreach ($nic in $vss.Pnic) {

            $netSys.NetworkInfo.Pnic | Where-Object { $_.Key -eq $nic } |

            Select-Object @{N = 'VMHost'; E = { $esx.Name } },

            @{N = 'Switch'; E = { $vss.Name } },

            @{N = 'SwitchType'; E = { 'VSS' } },

            @{N = 'pNic'; E = { $_.Device } },

            @{N = 'SpeedMB'; E = { $_.LinkSpeed.SpeedMB } },

            @{N = 'Duplex'; E = { $_.LinkSpeed.Duplex } }

        }

    }

    foreach ($vds in $netSys.NetworkInfo.ProxySwitch) {

        foreach ($nic in $vds.Spec.Backing.PnicSpec) {

            $netSys.NetworkInfo.Pnic | Where-Object { $_.Device -eq $nic.PnicDevice } |

            Select-Object @{N = 'VMHost'; E = { $esx.Name } },

            @{N = 'Switch'; E = { $vds.DvsName } },

            @{N = 'SwitchType'; E = { 'VDS' } },

            @{N = 'pNic'; E = { $_.Device } },

            @{N = 'SpeedMB'; E = { $_.LinkSpeed.SpeedMB } },

            @{N = 'Duplex'; E = { $_.LinkSpeed.Duplex } }

        }

    }

}

Thank you

Regards

Narayanan.

LucD
Leadership
Leadership

Do you actually ever write a script?

Or do you just want me to write your scripts?

I'm still waiting on a reply or feedback on your previous thread


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Narayanan_5245
Enthusiast
Enthusiast

Sorry for the inconvenience LuCD. Thanks all for your help.

I am at basic level in powercli/shell and learning and does not have much experience. Let me try on my own.

Regarding to the previous thread with related to boot delay, yet to test on one of the host

Regards

Narayanan

0 Kudos