Link to home
Start Free TrialLog in
Avatar of Raheman M. Abdul
Raheman M. AbdulFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Get HyperV Team name the given virtual Switch (name provided) is connected ?

Hi Guys
Using Powershell, How to get Hyper-V Team name the given virtual switch is connected to?
Thank you
Avatar of ITguy565
ITguy565
Flag of United States of America image

I believe the command you are looking for is
Get-NetLbfoTeam

Open in new window


PS C:\> Get-NetLbfoTeam
Name                   : VMTestTeam
Members                : {Ethernet 4, Ethernet}
TeamNics               : VMTestTeam
TeamingMode            : SwitchIndependent
LoadBalancingAlgorithm : TransportPorts
Status                 : Degraded


This document should give you a good understanding of NIC teaming with powershell :
http://techgenix.com/windows-nic-teaming-using-powershell-part/
http://techgenix.com/windows-nic-teaming-using-powershell-part6/
Avatar of Raheman M. Abdul

ASKER

looking for complete command please if possible
This worked. Found myself.
Thanks for expert's inputs.

$vSwitchName = "XYZ"
Try
{
    
    $vmnetswitch = Get-VMSwitch -Name $vSwitchName
    $vmnetwork = Get-NetAdapter -InterfaceDescription $($vmnetswitch.NetAdapterInterfaceDescription)
    if($vmnetwork)
    {
            write-host "vSwitch $($vSwitchName) is connected to $($vmnetwork.Name) Network team"
    }
else
{
    write-host "vSwitch $($vSwitchName) is NOT Found connected to any Network team"
}
}
catch
{
       Write-host "Error Getting vSwitch Info"
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Raheman M. Abdul
Raheman M. Abdul
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial