VMware Cloud Community
BBB36
Enthusiast
Enthusiast

Set failback value in vSwtich teaming and failover policy

Hello all. I'm looking for a script to check all vSwitches in one or multiple vCenters and in the teaming and failover policy, if failback is set to yes, it needs to be set to no and vice versa. Thank you.

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership

Are those VSS or VDS?

What code do you already have?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BBB36
Enthusiast
Enthusiast

Hi Luc. It's VSS. And tbh don't already have any codes yet.

Reply
0 Kudos
LucD
Leadership
Leadership

You could do something like this

foreach($vc in $global:defaultviservers){

    Get-VMHost -Server $vc -PipelineVariable esx |

    Get-VirtualSwitch -Standard -Server $vc -PipelineVariable vss |

    ForEach-Object -Process {

        $netSys = Get-View -Id $esx.ExtensionData.ConfigManager.NetworkSystem -Server $vc

        $spec = $vss.ExtensionData.Spec

        $spec.Policy.NicTeaming.RollingOrder = -not $vss.ExtensionData.Spec.Policy.NicTeaming.RollingOrder

        $netSys.UpdateVirtualSwitch($vss.Name,$spec)

    }

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BBB36
Enthusiast
Enthusiast

Thanks so much. I'll check this out and update! Sincerely appreciated.

Reply
0 Kudos