Set LAG as Default for New Port Groups on a VDS

When a DVS is created and configured with LAG any new default port groups do not use this is a default. This means when new port groups are deployed in the future this inevitably leads to issues as they will be misconfigured by default. Unfortunately there doesn’t appear to be a way to alter this via the GUI so we will need to turn to Powershell

In this example I am using vSphere 8 with a DVS called SYN-VMTraffic on version 7.0.3. My LAG is called lag1

1) Open Powersehll and Connect to vCenter

Connect ViServer {vcenter}

2) List DVS in environment

Get-VDSwitch SYN-VMTraffic

3) Show current Uplink Teaming Policy (in this example my VDS is called SYN-VMTraffic

Get-VDSwitch SYN-VMTraffic | Get-VDUplinkTeamingPolicy

4) Set Teaming Policy to default to lag1

Get-VDSwitch SYN-VMTraffic | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -UnusedUplinkPort "uplink 1", "uplink 2" -ActiveUplinkPort "lag1"