Forum Discussion
coxygt
Jul 26, 2021Brass Contributor
Interactive menu to choose task
Hi, I have started a new script for a routine task (checking resource meeting settings). The menu appears fine, but I am now not at all sure how to complete the script. #Connect to Exchange Onlin...
- Jul 28, 2021
@nless you need the do/while loops I'd throw it away ...
$menu = @" ********************** Resource Calendar Delegate Booking Settings ********************* * * * 1.Change delegate booking to Automatic * * 2.Change delegate booking to Manual * * 3.Check another resource calendar * * 4.Quit * * * **************************************************************************************** "@ Write-Host $menu -ForegroundColor Yellow $action = Read-Host 'Please choose the action to continue' switch($action) { 1 { # code goes here } 2 { # code } 3 { # code } default { exit # catch all } }
psophos
Jul 28, 2021Brass Contributor
@nless you need the do/while loops I'd throw it away ...
$menu = @"
********************** Resource Calendar Delegate Booking Settings *********************
* *
* 1.Change delegate booking to Automatic *
* 2.Change delegate booking to Manual *
* 3.Check another resource calendar *
* 4.Quit *
* *
****************************************************************************************
"@
Write-Host $menu -ForegroundColor Yellow
$action = Read-Host 'Please choose the action to continue'
switch($action)
{
1 { # code goes here }
2 { # code }
3 { # code }
default { exit # catch all }
}