vSphere vNetwork

 View Only
  • 1.  Importing port groups into vDS using powershell and

    Posted Dec 11, 2014 03:05 PM

    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}









  • 2.  RE: Importing port groups into vDS using powershell and
    Best Answer

    Posted Dec 11, 2014 03:46 PM

    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 }



  • 3.  RE: Importing port groups into vDS using powershell and

    Posted Dec 11, 2014 04:46 PM

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