Hi all,
how can I get the number of Uplinks for each Standard/Distributed vSwitch on ESXi Hosts with PowerCLI?
Try something like this
Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
$netSys = Get-View -Id $esx.ExtensionData.ConfigManager.NetworkSystem
$netsys.NetworkInfo.Vswitch |
ForEach-Object -Process {
New-Object -TypeName PSObject -Property ([ordered]@{
VMHost = $esx.Name
Name = $_.Name
Type = 'Standard vSwitch'
Uplinks = $_.Pnic.Count
})
}
if ($netsys.NetworkInfo.ProxySwitch) {
$netsys.NetworkInfo.ProxySwitch |
ForEach-Object -Process {
New-Object -TypeName PSObject -Property ([ordered]@{
VMHost = $esx.Name
Name = $_.DvsName
Type = 'Distributed vSwitch'
Uplinks = $_.UplinkPort.Count
})
}
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD!! I will check it
Very good support here! 🙂