VMware Cloud Community
BruceBannermanz
Contributor
Contributor
Jump to solution

Importing port groups into vDS using powershell and

I have a 5.5 VCenter with a 5.5 vDS. I am trying to import multiple port groups into the vDS using powershell. The script is below. I am running into problems trying to set the 'Teaming & Failover' option to 'Route based on physical load' from the default 'Route based on originating virtual port' to the individual port group I know i can do it from the client, but would like to do it with a script if possible. Anyone point me in the right direction? The port groups import fine with all the correct parameters i set, but i can't seem to find how to set the load balancing policy.

connect-viserver "myvcenter"

$vds = Get-VDSwitch -Name "My VD Switch"

Import-Csv c:\temp\vdsportgroup.csv | %{New-VDPortgroup -VDSwitch $vds -Name $_.Name -VlanId $_.VlanId -NumPorts $_.ports}







0 Kudos
1 Solution

Accepted Solutions
MKguy
Virtuoso
Virtuoso
Jump to solution

Edit: Scratch what I wrote earlier, that was with older VDS cmdlets. This should work:

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

You can just pipe the newly created port group object directly to the cmdlets like this:

Import-Csv c:\temp\vdsportgroup.csv | %{ New-VDPortgroup -VDSwitch $vds -Name $_.Name -VlanId $_.VlanId -NumPorts $_.ports | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -LoadBalancingPolicy LoadBalanceLoadBased }

-- http://alpacapowered.wordpress.com

View solution in original post

0 Kudos
2 Replies
MKguy
Virtuoso
Virtuoso
Jump to solution

Edit: Scratch what I wrote earlier, that was with older VDS cmdlets. This should work:

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

You can just pipe the newly created port group object directly to the cmdlets like this:

Import-Csv c:\temp\vdsportgroup.csv | %{ New-VDPortgroup -VDSwitch $vds -Name $_.Name -VlanId $_.VlanId -NumPorts $_.ports | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -LoadBalancingPolicy LoadBalanceLoadBased }

-- http://alpacapowered.wordpress.com
0 Kudos
BruceBannermanz
Contributor
Contributor
Jump to solution

Thank you sir, great help. I had found the old commands you initially referenced, but thanks for posting the newer commands.

0 Kudos