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

Raheman M. Abdul
Raheman M. Abdul used Ask the Experts™
on
Hi Guys
Using Powershell, How to get Hyper-V Team name the given virtual switch is connected to?
Thank you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
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/
Raheman M. AbdulMessaging and Directory Services

Author

Commented:
looking for complete command please if possible
Raheman M. AbdulMessaging and Directory Services

Author

Commented:
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

Messaging and Directory Services
Commented:
$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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial