Change VDS Port Group Load Balancing Policy with PowerCLI


#Get current load balancing policy
$VDS = VDS name
$pg = Portgroup name
Get-VDswitch -Name $VDS | Get-VDPortgroup $pg | Get-VDUplinkTeamingPolicy

#Set new load balancing policy

#Set Route based on IP hash
Get-VDswitch -Name $VDS | Get-VDPortgroup $pg | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -LoadBalancingPolicy LoadBalanceIP

#Set Route based on source MAC hash
Get-VDswitch -Name $VDS | Get-VDPortgroup $pg | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -LoadBalancingPolicy LoadBalanceSrcMac

#Set Route based on originating virtual port
Get-VDswitch -Name $VDS | Get-VDPortgroup $pg | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -LoadBalancingPolicy LoadBalanceSrcId

#Set Use explicit failover order
Get-VDswitch -Name $VDS | Get-VDPortgroup $pg | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -LoadBalancingPolicy ExplicitFailover

#Set Route based on physcial NIC load
Get-VDswitch -Name $VDS | Get-VDPortgroup $pg | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -LoadBalancingPolicy LoadBalanceLoadBased

#Remove $pg to apply new load balancing policy to all portgroups on the same VDS
Get-VDswitch -Name $VDS | Get-VDPortgroup | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -LoadBalancingPolicy LoadBalanceIP

For other Set-VDUplinkTeamingPolicy cmdlet parameters refer to the following documentation:
https://pubs.vmware.com/vsphere-6-5/index.jsp#com.vmware.powercli.cmdletref.doc/Set-VDUplinkTeamingPolicy.html

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.