GithubHelp home page GithubHelp logo

Comments (4)

JamesKehr avatar JamesKehr commented on July 19, 2024

Option 3: Prompt for action. An old school text menu will work just fine for this.

$Title = "Address Hash algorithm detected!"
$Caption = @"
A pre-requisite check has failed. The Address Hash algorithm is not supported in SET.
The Microsoft recommendation is to switch to the Hyper-V Port algorithm.
Please quit if testing is needed before converting to Hyper-V Port.

S - Switch to Hyper-V Port
Q - Quit
 
Select a choice:
"@
 
$coll = @()
#$coll = New-Object System.Collections.ObjectModel.Collection
 
$a = [System.Management.Automation.Host.ChoiceDescription]::new("&S - Switch to Hyper-V Port")
$a.HelpMessage = "Proceed with the script, and use the recommended Hyper-V Port load balancing algorithm."
 
$coll+=$a
 
$b = [System.Management.Automation.Host.ChoiceDescription]::new("&Q - Quit")
$b.HelpMessage = "Quit the script so Hyper-V Port can be tested first."

$coll+=$b

$result = $host.ui.PromptForChoice($Title, $Caption, $coll, 0) 

switch ($result) {
    0 {
        Write-Output "Switching to Hyper-V Port mode."
        $lbAlgorithm = "Hyper-V Port"
    }

    1 {
        Write-Warning "A pre-requisite check has failed. The Address Hash algorithm is not supported in SET."
        break
    }
}

from convert-lbfo2set.

dcuomo avatar dcuomo commented on July 19, 2024

I would recommend using Pester to do validation. It will greatly simply your code writing as the framework is simple and standard. It boils everything you wrote above into about 3 or 4 lines of code (no seriously).

I also think there will be more of these, so I suggest we run a prerequisite validation test with pester, then the migration, then a post-validation test to verify everything is the way it's supposed to be. Something like (Syntax and properties is not exact):

It "Should not use the address hash algorithm" {
(Get-NetLBFOTeam).Algorithm | Should not be "Address Hash"
}

<>

It "Should be Hyper-V Port or Dynamic" {
(Get-VMSwitchTeam).Algorithm | Should be "Hyper-V Port" -or "Dynamic"
}

from convert-lbfo2set.

JamesKehr avatar JamesKehr commented on July 19, 2024

That Pester code is slick. I need to figure out how to use that.

if -EnableBestPractices is set then I say we change to Hyper-V Port, as this is the best practice. Otherwise fail in the pre-req check.

from convert-lbfo2set.

dcuomo avatar dcuomo commented on July 19, 2024

Yes, agreed. Do you want to give that a shot after we complete the host vNIC migration binary? Here's where the existing prereq code is, and i'm sure you could figure this out with the example!

image

from convert-lbfo2set.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.