Forum Discussion

coxygt's avatar
coxygt
Brass Contributor
Jul 26, 2021

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...
  • psophos's avatar
    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 }
    }

Resources