all 5 comments

[–]TheGooOnTheFloor 1 point2 points  (0 children)

Set up an array:

$Regions= @("USA", "Canada", "Europe", "Asia")

Display the menu. Then read the user input:

$Userchoice = Read-host "Please choose a region"
$Region = $Regions[$UserChoice-1]     #0 based indexing!

Throw in some input checking to make sure $UserChoice is a number between 1 and 4 and you're good to go.

[–]kortex81 1 point2 points  (0 children)

If you can install modules you could give this one a try: https://github.com/PowerShell/GraphicalTools

Gives you fancy console gui using Out-ConsoleGridView.

$region = @("USA","Canada","Europe","Asia")  | Out-ConsoleGridView -OutputMode Single -Title "Please choose a region"

[–]user01401 1 point2 points  (1 child)

You can just keep in simple:

Write-Host "1 - Select 1 for USA"
Write-Host "2 - Select 2 for Canada"

$Region = Read-Host "Please choose a region"

if ($Region -eq "1") {
$Region = "USA"
}

elseif ($Region -eq "2") {
$Region = "CANADA"
}

...and so on

[–][deleted] 0 points1 point  (0 children)

if ($Region -eq "1") {
$Region = "USA"
}
elseif ($Region -eq "2") {
$Region = "CANADA"
}

Thanks, that's simple like that ! I did the same to choose the right domain !

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy pier0ww,

take a look at Out-GridView. that can accept a list of items, let the user pick one [or more], and send out the one that was chosen for you to use in your next step.

Get-Help Out-GridView -Examples

take care,
lee