VMware Cloud Community
AaronAnderson
Contributor
Contributor
Jump to solution

Make all nics active in team

I'm trying to write a generic PowerCLI script for deploying hosts...

This line does what I want, but the nics are not always named vmnic0 and vmnic2. Could be anything between 1 and 8.. depends on hardware configuration.

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

This will give me the nics that are available.

Get-VMHost LouPrEsx004.zcloud.com | Get-VirtualSwitch -name vSwitch0 | select Nic

If someone could help me put  this together, I'd appreciate it. Not savvy enough to do it myself.

0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

The next PowerCLI code will make all of the nics of vSwitch0 part of the teaming policy:

$vSwitch0 = Get-VMHost LouPrEsx004.zcloud.com | Get-VirtualSwitch -Name vSwitch0

$vSwitch0 | Get-NicTeamingPolicy |

Set-NicTeamingPolicy -MakeNicActive ($vSwitch0 | Select-Object -ExpandProperty Nic)

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

0 Kudos
1 Reply
RvdNieuwendijk
Leadership
Leadership
Jump to solution

The next PowerCLI code will make all of the nics of vSwitch0 part of the teaming policy:

$vSwitch0 = Get-VMHost LouPrEsx004.zcloud.com | Get-VirtualSwitch -Name vSwitch0

$vSwitch0 | Get-NicTeamingPolicy |

Set-NicTeamingPolicy -MakeNicActive ($vSwitch0 | Select-Object -ExpandProperty Nic)

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos