PowerCLI – Distributed Virtual Switch Port Group Load Balancing Policies

While working on scripting the creation of Distributed Virtual Switches in a new virtual infrastructure of ours, I came to realize that VMware’s documentation for the Set-VDUplinkTeamingPolicy cmdlet was missing something.

Although Standard Virtual Switches only give you the ability to Load Balance on Source IP, Source MAC Address, Original Port ID, or by specifying an explicit failover order, Distributed Virtual Switches include a 5th option for “Load-based Teaming”, or by “Physical NIC Load”.

VMware’s CMDLET Reference link is here

According to the documentation, the -LoadBalancingPolicy parameter is described here: “Specifies the load balancing policy for the corresponding distributed port, port group, or switch. The value can be LoadBalanceIP, LoadBalanceSrcMac, LoadBalanceSrcId, or ExplicitFailover.”

I assumed someone else had noticed this, but (perhaps due to my lack of finding the proper Google Search) I was unable to find what I wanted to script using a Physical NIC Load load-balancing policy.

The last thing I wanted to do was to be forced to stop the build script, and tell the user to temporarily use the vSphere Web Client.  Instead, I decided to make the change in the GUI, and invoke PowerCLI to see what the variable was.

Get-VDPortgroup MyPortGroup | Get-VDUplinkTeamingPolicy | fl

VDPortgroup                      : MyPortGroup
NotifySwitches                   : True
NotifySwitchesInherited          : True
LoadBalancingPolicy              : LoadBalanceLoadBased
LoadBalancingPolicyInherited     : False
FailoverDetectionPolicy          : LinkStatus
ActiveUplinkPort                 : {dvUplink1, dvUplink2}
StandbyUplinkPort                : {}
UplinkPortOrderInherited         : True
FailBack                         : False
FailBackInherited                : True
UnusedUplinkPort                 : {}
FailoverDetectionPolicyInherited : True
Uid                              : /VIServer=tcwd\matt@…..

Now, I was able to modify my script and update the rest of my port groups.  I could have modified the above with:

Get-VDPortgroup MyPortGroup | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -LoadBalancingPolicy LoadBalanceLoadBased




  1. Max

    thx. worked fine for me.

  2. BB

    Thanks a lot. This saved me some time. 🙂


Leave a Comment

Your email address will not be published. Required fields are marked *