Can anyone suggest a way to tell what virtual NIC is connected to which physical NIC when they are teamed in an Active-Active vSwitch (besides comparing the MAC addresses)?
Afaik, the easiest way to do that is to use the Config.Network property of the HostSystem object which points to a HostNetworkInfo object.
This script list the Vswitches (and their active and standby NICs) and all the portgroups with their active and standby NICs.
$esxName = "mmmstv001.muac.corp.eurocontrol.int" $esx = Get-VMHost $esxName | Get-View foreach($vswitch in $esx.Config.Network.Vswitch){ Write-Host "Vswitch" $vswitch.Name -ForegroundColor red Write-Host "`tActive NICs" foreach($actNic in $vswitch.Spec.Policy.NicTeaming.NicOrder.ActiveNic){ Write-Host "`t" $actNic } Write-Host "`tStandby NICs" foreach($sbyNic in $vswitch.Spec.Policy.NicTeaming.NicOrder.StandbyNic){ Write-Host "`t" $sbyNic } foreach($pg in $esx.Config.Network.Portgroup){ if($pg.Spec.VswitchName -eq $vswitch.Name){ Write-Host "`t`t" $pg.Spec.Name -ForegroundColor blue Write-Host "`t`tActive NICs" foreach($actNic in $pg.Spec.Policy.NicTeaming.NicOrder.ActiveNic){ Write-Host "`t`t`t" $actNic } Write-Host "`t`tStandby NICs" foreach($sbyNic in $pg.Spec.Policy.NicTeaming.NicOrder.StandbyNic){ Write-Host "`t`t`t" $sbyNic } } } }
Since I don't know in which format you wanted the output, I wrote the data to the console.
Note that if there are no active and/or standby NICs listed for a portgroup, that this portgroup takes NIC binding and NIC order of the Vswitch.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Afaik, the easiest way to do that is to use the Config.Network property of the HostSystem object which points to a HostNetworkInfo object.
This script list the Vswitches (and their active and standby NICs) and all the portgroups with their active and standby NICs.
$esxName = "mmmstv001.muac.corp.eurocontrol.int" $esx = Get-VMHost $esxName | Get-View foreach($vswitch in $esx.Config.Network.Vswitch){ Write-Host "Vswitch" $vswitch.Name -ForegroundColor red Write-Host "`tActive NICs" foreach($actNic in $vswitch.Spec.Policy.NicTeaming.NicOrder.ActiveNic){ Write-Host "`t" $actNic } Write-Host "`tStandby NICs" foreach($sbyNic in $vswitch.Spec.Policy.NicTeaming.NicOrder.StandbyNic){ Write-Host "`t" $sbyNic } foreach($pg in $esx.Config.Network.Portgroup){ if($pg.Spec.VswitchName -eq $vswitch.Name){ Write-Host "`t`t" $pg.Spec.Name -ForegroundColor blue Write-Host "`t`tActive NICs" foreach($actNic in $pg.Spec.Policy.NicTeaming.NicOrder.ActiveNic){ Write-Host "`t`t`t" $actNic } Write-Host "`t`tStandby NICs" foreach($sbyNic in $pg.Spec.Policy.NicTeaming.NicOrder.StandbyNic){ Write-Host "`t`t`t" $sbyNic } } } }
Since I don't know in which format you wanted the output, I wrote the data to the console.
Note that if there are no active and/or standby NICs listed for a portgroup, that this portgroup takes NIC binding and NIC order of the Vswitch.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks LucD! we're going to try this