Re-adding prevention of SAC release. Also adding tests to determine at prereq check if SAC release and fail test.
Lastly, swapped out "exit" for "throw" to create a terminating error but not exit the shell.
This commit is contained in:
Родитель
5b26b0b31b
Коммит
d24b557666
|
@ -79,13 +79,12 @@ Function Convert-LBFO2Set {
|
|||
}
|
||||
else
|
||||
{
|
||||
Write-Error "An LBFO team associated with $LBFOTeam could not be detected."
|
||||
Throw "An LBFO team associated with $LBFOTeam could not be detected."
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Error "Failed to find an LBFO team or vSwitch named $LBFOTeam`."
|
||||
exit
|
||||
Throw "Failed to find an LBFO team or vSwitch named $LBFOTeam`."
|
||||
}
|
||||
|
||||
Remove-Variable isLBFOTeam,isvSwitch,tmpAdapter,tmpTeam -ErrorAction SilentlyContinue
|
||||
|
@ -100,8 +99,7 @@ Function Convert-LBFO2Set {
|
|||
|
||||
if (-NOT $here)
|
||||
{
|
||||
Write-Error "Could not find the module path."
|
||||
exit
|
||||
throw "Could not find the module path."
|
||||
}
|
||||
|
||||
# detect the version of Windows
|
||||
|
@ -114,26 +112,24 @@ Function Convert-LBFO2Set {
|
|||
{
|
||||
switch ($osBldVer)
|
||||
{
|
||||
{ $_ -ge 14393 -and $_ -lt 17763} {
|
||||
14393 {
|
||||
$nicReconnBin = "nicReconnect1.exe"
|
||||
}
|
||||
|
||||
{ $_ -ge 17763 } {
|
||||
17763 {
|
||||
$nicReconnBin = "nicReconnect5.exe"
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
Write-Error "This version of Windows is not yet certified for Convert-LBFO2SET."
|
||||
exit
|
||||
throw "This version of Windows is not yet certified for Convert-LBFO2SET."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
Write-Error "A supported version of Windows was not detected."
|
||||
exit
|
||||
throw "A supported version of Windows was not detected."
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,8 +250,7 @@ Function Convert-LBFO2Set {
|
|||
}
|
||||
catch
|
||||
{
|
||||
Write-Error "Failed to migrate host vNIC(s)."
|
||||
exit
|
||||
throw "Failed to migrate host vNIC $($HostvNIC.Name)."
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,8 +258,7 @@ Function Convert-LBFO2Set {
|
|||
$vmMigGood = Get-VMNetworkAdapter -All | Where-Object SwitchName -EQ $configData.LBFOVMSwitch.Name -ErrorAction SilentlyContinue
|
||||
if ($vmMigGood)
|
||||
{
|
||||
Write-Error "Critical vmNIC migration failure. The following virtual NICs were not migrated to the new SET switch:`n$($vmMigGood | ForEach-Object { "`n`t$($_.Name) [$(if ($_.VMName) {"$($_.VMName)"} else {"host"})] " })"
|
||||
exit
|
||||
throw "Critical vmNIC migration failure. The following virtual NICs were not migrated to the new SET switch:`n$($vmMigGood | ForEach-Object { "`n`t$($_.Name) [$(if ($_.VMName) {"$($_.VMName)"} else {"host"})] " })"
|
||||
}
|
||||
|
||||
#region Fire and Brimstone
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
Describe 'OSValidation' -Tag PreValidation {
|
||||
Context HostOS {
|
||||
$NodeOS = Get-CimInstance -ClassName 'Win32_OperatingSystem'
|
||||
|
||||
# detect the version of Windows
|
||||
$osBldVer = [System.Environment]::OSVersion.Version.Build
|
||||
|
||||
### Verify the Host is sufficient version
|
||||
It "${env:ComputerName}`: Must be Windows Server 2016, or Server 2019" {
|
||||
$NodeOS.Caption | Should be ($NodeOS.Caption -like '*Windows Server 2016*' -or $NodeOS.Caption -like '*Windows Server 2019*')
|
||||
}
|
||||
|
||||
It "${env:ComputerName}`: Must NOT be a SAC release" {
|
||||
# 14393 defines Server 2016 RS1
|
||||
# 17763 defines Server 2019 RS5
|
||||
$osBldVer | Should -BeIn @(14393, 17763)
|
||||
}
|
||||
|
||||
$HyperVInstallation = (Get-WindowsFeature -Name Hyper-V -ComputerName $env:ComputerName -ErrorAction SilentlyContinue).InstallState
|
||||
|
||||
It "${env:ComputerName}`: Must have Hyper-V installed" {
|
||||
|
|
Загрузка…
Ссылка в новой задаче