Windows Server 2012 nic teaming with powershell

Some PowerShell to configure Nic Teaming on Windows Server 2012.  Note: pick teaming mode and load balancing algorithm to suit your networking environment.  The config below is for two NICs going to independent switches in active-passive mode (no LACP).  Also note that the order Windows discovers and labels NICs may not match your hardware vendor’s labelling at the back of the server.

# Check current state of NICs and do teaming
if (get-netLbfoTeam) {write-host "Nic Team already exists"} else 
    write-host "Renaming NICs"
    #Rename Ethernet & Ethernet2 to Nic1 & Nic2 etc
    get-netAdapter | ForEach-Object { $_ | Rename-NetAdapter -NewName "Nic$nicIndex" ;  $nicIndex++}
    #Create team for Nic1,2
    write-host "Teaming Nic1 and Nic2"
    $team = new-netlbfoteam -name NicTeam -teammembers Nic1,Nic2 -TeamingMode <strong>SwitchIndependent</strong> -loadBalancingAlgorithm <strong>TransportPorts</strong> -Confirm:$false

    #Configure NIC2 as standby
    write-host "Configuring Nic2 as standby"
    Set-NetLbfoTeamMember -Name "Nic2" -AdministrativeMode Standby
    # loop until this NIC team is up
    while ($team.Status -ne "Up") 
	write-host "Waiting for team to come up" ;
	$team | get-netlbfoTeamMember | select Name,OperationalStatus,FailureReason | format-table
	$team = Get-NetLbfoTeam -Name $team.Name ; 
	sleep 2
    # disable NETBIOS over TCP/IP on new adapter (legacy protocol not required)
    Get-WmiObject Win32_NetworkAdapterConfiguration -filter "ipenabled = 'true'" | ForEach-Object { $_.SetTcpipNetbios($NETBIOS_DISABLED)}

Find more IT Infrastructure tips at

Leave a Reply