Hi all,
soemtimes i have to read the CDP-Infos of my ESX-Hosts...so i use the following script. It delivers a simple commandline-Output of the needed information.
What i want is to use the Gridview, but I´m unable to convert the script into the right form....any idea?
Script:
Connect-VIServer virtualcenter
$(Get-VMHost esxhost* |Sort-Object $_.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
if( $hint.ConnectedSwitchPort ) {write-Host $esxname,",",$physnic.Device,",",$hint.ConnectedSwitchPort.DevId,",",$hint.ConnectedSwitchPort.PortId }
else { $esxname,$physnic.Device,“Not connected! ” }}}} )|Out-GridView
Thanks in advance
Chakoe