Version Info:
vSphere 6.7U1
PowerCLI 6.5.1
Standalone Host (no vCenter yet)
Created a Standard Virtual Switch on my Host. Wanting to create 2 PortGroups used for iSCSI connection. Created a script that works... have created the PortGroups, then able to create the VMkernel Ports & assign them to the proper PortGroup. All seems fine when I run the script.. i.e. no errors. But, when I log into the Host UI and verify my configs 'took', I see the Nic Teaming Policy for each of my PortGroups did not get changed. If you recall, for iSCSI, you have to have ONLY ONE vmnic assigned per PG as 'active', and all others as 'unused'. In my script, I state to use 1 of my vmnic's as active and 1 as unused, but the PowerCLI configuration doesn't take affect on the Host. Just trying to figure out why. Below is the script I created for this configuration:
#Create vSwitch1 PortGroups and VMkernel PortGroups
$vmk1 = 'ISCSI-1','ISCSI-2'
$i = 0
if($i -lt 2) {
foreach ($vmk in $vmk1) {
#Get the vmnics for setting Active & Unused for each Portgroup
$vmkAct = Read-Host "
Enter Active Nic for $vmk teaming policy (vmnic#) "
$vmkUnused = Read-Host "
Enter Unused Nic for $vmk teamng policy (vmnic#) "
#Create the Portgroups, then set the Nic Teaming Policy
New-VirtualPortGroup -VirtualSwitch $vs1 -Name $vmk | Out-Null
Get-VirtualPortgroup -Name $vmk | Get-NicTeamingPolicy | Set-NicTeamingPolicy -InheritFailoverOrder $false -MakeNicActive $vmkAct -MakeNicUnused $vmkUnused | Out-Null
$i++
}
#Create vSwitch1 VMkernel PortGroups
$n = 1
foreach ($vmk in $vmk0) {
$vs1vmkIP = Read-Host "Enter vmk$n IP "
New-VMHostNetworkAdapter -VirtualSwitch $vs1 -PortGroup $vmk -IP $vs1vmkIP -SubnetMask $vmkSubnet -Mtu 9000 -Confirm:$false | Out-Null
$n++
}
}
Thanks for any assistance provided.
(Shane)
#vExpert , #VeeamVanguard
Sr. Systems Engineer