You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a possible condition where $AllowOutage is $false and there is only a single adapter in $configData.NetLBFOTeam.Memeber that will create an invalid NIC name.
Since $configData.NetLBFOTeam.Members resolves to a string when there is a single member, the result of the operation is char[0] of the string name. Which makes $NetAdapterNames equal to the first letter in the NIC name and will cause an error cascade whenever called.
Commented code below.
`
#region Create new SET team
# jak: alternate condition: $configData.NetLBFOTeam.Members -isnot [Array]
if ($AllowOutage -eq $true -and $configData.NetLBFOTeam.Members.Count -eq 1)
{
$NetAdapterNames = $configData.NetLBFOTeam.Members
$AdapterMigrationNeeded = $false
# Only one pnIC - Destroy the LBFOTeam
Remove-NetLbfoTeam -Name $configData.NetLBFOTeam.Name -Confirm:$false
}
else
{
<#
jak: It's still possible to reach this code with a single LBFO team member, if AllowOutage is $false.
if ($configData.NetLBFOTeam.Members -is [Array])
{
$NetAdapterNames = $configData.NetLBFOTeam.Members[0]
}
else
{
$NetAdapterNames = $configData.NetLBFOTeam.Members
}
#>
$NetAdapterNames = $configData.NetLBFOTeam.Members[0]
$AdapterMigrationNeeded = $true
#jak: change $configData.NetLBFOTeam.Members[0] to $NetAdapterNames
Remove-NetLbfoTeamMember -Name $NetAdapterNames -Team $configData.NetLBFOTeam.Name -Confirm:$False
}`
You also cannot remove the last member of the team. So we need to rethink what to do when -AllowOutage is false and there is only a single LBFO team member. Just in case.
Remove-NetLbfoTeamMember : Cannot remove the only member 'NIC01' of team 'Team1'
At line:30 char:9
Spotted a couple of problems in this section.
There is a possible condition where $AllowOutage is $false and there is only a single adapter in $configData.NetLBFOTeam.Memeber that will create an invalid NIC name.
Since $configData.NetLBFOTeam.Members resolves to a string when there is a single member, the result of the operation is char[0] of the string name. Which makes $NetAdapterNames equal to the first letter in the NIC name and will cause an error cascade whenever called.
Commented code below.
`
#region Create new SET team
# jak: alternate condition: $configData.NetLBFOTeam.Members -isnot [Array]
if ($AllowOutage -eq $true -and $configData.NetLBFOTeam.Members.Count -eq 1)
{
$NetAdapterNames = $configData.NetLBFOTeam.Members
$AdapterMigrationNeeded = $false
You also cannot remove the last member of the team. So we need to rethink what to do when -AllowOutage is false and there is only a single LBFO team member. Just in case.
Remove-NetLbfoTeamMember : Cannot remove the only member 'NIC01' of team 'Team1'
At line:30 char:9
The text was updated successfully, but these errors were encountered: