Jump to content

HyperV virtuelle Switche


Recommended Posts

Moin @NilsK,

 

vor 8 Minuten schrieb NilsK:

Ist schon etwas älter, sollte aber immer noch funktionieren.

,

das Script kann nicht mit SET-Switches umgehen. :)

 

Auf die Schnelle

# Hyper-V level: vSwitches
$vSwitches = (Get-VMSwitch | Where-Object {$_.SwitchType -eq 'External'} | Sort-Object Name)
foreach ($vSw in $vSwitches)
{
  # Host level: uplink ports and teams (i.e. host NICs)
  # get the uplink port, i.e. the host NIC that is connected
  if($vSw.EmbeddedTeamingEnabled -eq $false)
  {
      # Ich bin ein legacy Switch
      $Uplink = (Get-NetAdapter -InterfaceDescription ($vSw.NetAdapterInterfaceDescription))
      # ...
      # if NIC team has been retrieved get member NICs
      if ($Team)
      {
        $TeamMembers = (Get-NetLbfoTeamMember -Team $Team.Name | Sort-Object Name)
        # collect team member NIC names
        $TeamNICs = @()
        foreach ($TeamNIC in $TeamMembers) 
        {
          $TeamNICs += ,$TeamNIC.Name
        }
      }
  } else
  {
    # Ich bin ein SET Switch
    $TeamNICs = @()
    foreach($NIC in $vSw.NetAdapterInterfaceDescriptions)
    {
        $TeamNICs += ,$NIC
    }
  }
  # End Host level
  ...

 

sollte es damit integriert sein. (Ohne groß zu testen.)

 

HTH

Jan

Link to comment

Moin,

 

ah, nee, das kann gut sein - die gab es damals schlicht noch nicht. :lol3:

 

Falls jemand die Gelegenheit hat, das zu prüfen und zu testen - dann würde ich das Skript in neuer Fassung (und mit Hinweis auf die Beteiligung) posten. Hab leider keinen Zugriff auf passende Umgebungen ...

 

Gruß, Nils

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...