If you are just here looking for the script, here it is below. Please be warned, just running this script will cause the network to disconnect. If you don’t have the switch setup for LACP, you will stay disconnected. I suggest you have iDrac access to your server before running the script.

This script will disconnect network connectivity!

####
$ipaddress = "192.168.1.10"
$gateway = "192.168.1.1"
$netmask = "255.255.255.0"
$DNS1 = "192.168.1.2"
$DNS2 = "192.168.1.3"
####

## Pulling before changes information
Get-NetAdapter
IPConfig /all
##


echo "new nic teaming device"
New-NetLbfoTeam -Name "Team1" -TeamMembers "NIC1","NIC2" -TeamingMode LACP -LoadBalancingAlgorithm Dynamic -Confirm:$false


Remove-NetRoute -InterfaceAlias "Team1" -Confirm:$false
netsh interface ip set address "Team1" static $ipaddress $netmask $gateway
Get-NetAdapter Team1 | Set-DnsClientServerAddress -ServerAddresses $DNS1,$DNS2

# Disable IPv6
Get-NetAdapterBinding | Where-Object ComponentID -EQ 'ms_tcpip6'
Disable-NetAdapterBinding -Name 'Team1' -ComponentID 'ms_tcpip6'
Get-NetAdapterBinding -Name 'Team1' -ComponentID 'ms_tcpip6'

## Pulling after changes
Get-NetAdapter
IPConfig /all
##
NIC-Teaming / LACP on Server 2019

Documentation: https://docs.microsoft.com/en-us/powershell/module/netlbfo/new-netlbfoteam?view=windowsserver2019-ps

NIC-Teaming or LACP is setting up multiple NIC adapters to share address space. The idea is that if one network adapter goes down, then the server will continue to stay connected via one of the other available network adapters. There are multiple purposes for teaming network adapters, this setup is for dynamic load balancing in LACP Mode.

The first part of the script is setting the variables:

####
$ipaddress = "192.168.1.10"
$gateway = "192.168.1.1"
$netmask = "255.255.255.0"
$DNS1 = "192.168.1.2"
$DNS2 = "192.168.1.3"
####

The ip address will be the single address you want the 2 network adapters to share. The gateway, netmask, and DNS servers will be specific to the network.

The second part of this script is designed to get the current information for the server. This will output the network information before any changes are made. You can make references to this information after the script has run to see the difference.

## Pulling before changes information
Get-NetAdapter
IPConfig /all
##

The 3rd part of this script will require you to input some information.

echo "new nic teaming device"
New-NetLbfoTeam -Name "Team1" -TeamMembers "NIC1","NIC2" -TeamingMode LACP -LoadBalancingAlgorithm Dynamic -Confirm:$false

You will need to update the name of the network adapters to the network adapters you have plugged into the server. You can find this information by running:

Get-NetAdapter

You’ll notice the Team1 is built using NIC1 and NIC2. Replace NIC1 and NIC2 with the names of the 2 adapters you would like you use for the team.

The 4th part is where the real changes are made.

Remove-NetRoute -InterfaceAlias "Team1" -Confirm:$false
netsh interface ip set address "Team1" static $ipaddress $netmask $gateway
Get-NetAdapter Team1 | Set-DnsClientServerAddress -ServerAddresses $DNS1,$DNS2

Remote-NetRoute is going to remove any routing information that might be inadvertantly assigned to the team. netsh will assign the IP, Netmask, and Gateway to the Team. The last line here will assign DNS to the new Team.

The 5th part deals with IPv6 on the server. This might be controversial to disable. If you don’t want to disable IPv6 on the Team, then delete these lines.

# Disable IPv6
Get-NetAdapterBinding | Where-Object ComponentID -EQ 'ms_tcpip6'
Disable-NetAdapterBinding -Name 'Team1' -ComponentID 'ms_tcpip6'
Get-NetAdapterBinding -Name 'Team1' -ComponentID 'ms_tcpip6'

The last part of the script is to see all of the changes that have been made. This can be compared to the original call at the start of the script.

## Pulling after changes
Get-NetAdapter
IPConfig /all
##

Finally, please remember you will need to work with your networking team to enable LACP. There is an order of operations. You will want to enable the Windows Server 2019 Teaming first. Then make the changes on the switch.