Menu within a Menu

Hi,

Newbie here.

I am creating a script to give our IT folks testing options but I am having difficulty showing a menu within a menu.

If the user select’s option # 2; I would like to show the user a new menu with different options to perform. Any input is appreciated. Thank you in advance.

function Show-MainMenu
{ param ( [string]$Title = 'IT Test' )
Clear-Host
Write-Host "================ $Title ================"
Write-Host "Select Type of Test:"
Write-Host "`n"
Write-Host "1: Server Mode"
Write-Host "2: Client Mode"
Write-Host "`n"
Write-Host "Q: Press 'Q' to quit."
Write-Host "`n" }
#
function ServerMode
{ Write-Host "Server Mode" }
function ClientMode
{ Write-Host "Client Mode" }
#
do { Show-MainMenu –Title 'IT Test' $input = Read-Host "Enter your Selection" switch ($input)
{ '1' { ServerMode }
'2' { ClientMode }
'q' { return } } pause }
until ($input -eq 'q')

 

I can’t read your code. Make sure you are following directions here and re-post.

If you add a Start-Sleep -Seconds 5 to either of your functions you’ll see that they’re being called. They’re then exiting and then returning to the do-until loop.

You need to run the loop until ($input -eq ‘q’ -or $input -eq ‘1’ -or $input -eq ‘2’)