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.
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)
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)