VMware Cloud Community
OBXMAN007
Contributor
Contributor
Jump to solution

Set vmnics As Active and Override Failover Order

Hello,

I am trying to accomplish TWO things::

vswitch: vSwitch0

portgroups: pgvVMOTION, Service Console

I have two vmnics on vSwitch0: vmnic0 and vmnic2

FIRST:

I need to use powercli to set both of the vmnics as ACTIVE.

SECOND:

I need to be able to select "Override switch failover order" ...AND...

for port group pgvVMOTION set priority of vmnics as: vmnic0 first, vmnic2 as second, in that order

...and then flip it for port group "Service Console" ... I need to set vmnic2 as first and vmnic0 as second , in that order.

I have found bits of code out there related to this, but couldn't put it all together.

Many thanks in advance!!!

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

In the latest PowerCLI build you can do all that with the Set-NicTeamingPolicy cmdlet.

For the vSwitch

Get-VMHost <esx-name> | Get-VirtualSwitch -Name vSwitch0 | Get-NicTeamingPolicy | `
   Set-NicTeamingPolicy -MakeNicActive vmnic0,vmnic2

Then for the portgroups

Get-VMHost <esx-name> | Get-VirtualPortGroup -Name pgvVMOTION | Get-NicTeamingPolicy | `
   Set-NicTeamingPolicy -MakeNicActive vmnic0,vmnic2
Get-VMHost <esx-name> | Get-VirtualPortGroup -Name "Service Console" | Get-NicTeamingPolicy | `
   Set-NicTeamingPolicy -MakeNicActive vmnic2,vmnic0

Note that you don't need to set the order for portgroup pgvMotion since it's the same order as the switch.

The portgroup will get by default the same order as the switch.

____________

Blog: LucD notes

Twitter: lucd22


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

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

In the latest PowerCLI build you can do all that with the Set-NicTeamingPolicy cmdlet.

For the vSwitch

Get-VMHost <esx-name> | Get-VirtualSwitch -Name vSwitch0 | Get-NicTeamingPolicy | `
   Set-NicTeamingPolicy -MakeNicActive vmnic0,vmnic2

Then for the portgroups

Get-VMHost <esx-name> | Get-VirtualPortGroup -Name pgvVMOTION | Get-NicTeamingPolicy | `
   Set-NicTeamingPolicy -MakeNicActive vmnic0,vmnic2
Get-VMHost <esx-name> | Get-VirtualPortGroup -Name "Service Console" | Get-NicTeamingPolicy | `
   Set-NicTeamingPolicy -MakeNicActive vmnic2,vmnic0

Note that you don't need to set the order for portgroup pgvMotion since it's the same order as the switch.

The portgroup will get by default the same order as the switch.

____________

Blog: LucD notes

Twitter: lucd22


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

OBXMAN007
Contributor
Contributor
Jump to solution

Hi Luc,

Your code worked beautifully and perfectly the first time.

I found bits of code here and there but nothing definitive and concise as you provided.

I don't say it lightly when I say........Luc ROCKS THE PLANET!!!!

Thanks a million.

M.

Reply
0 Kudos