none
PS: menu multiple selection? RRS feed

  • Question

  • Hi,

    I'd like to create a menu selection, works for 1 selection but what about multiple selections, f.e. 1,2?

    Got it working via workaround, please advise howto implement properly.

    J.

    $ADGroups = get-content C:\ADGroups
    
    $menu = @{}
    for ($i=1;$i -le $ADGroupNames.count; $i++) 
    { 
      Write-Host "$i. $($ADGroupNames.ADGroupName[$i-1])" 
      $menu.Add($i,($ADGroupNames[$i-1]))
    
    }
    
    #[int]$ans = Read-Host 'Enter selection'
    
    $Numbers = '7,10' 
    $NumbersCorrected = $Numbers.split(',') | ForEach-Object {$psitem -1} # $Numbers count from 0 so -1
    $ADGroupToAddUsersto = $ADGroupNames.ADgroupName[$NumbersCorrected]
    
      


    Jan Hoedt

    • Moved by Bill_Stewart Friday, March 15, 2019 7:49 PM Help vampire
    Thursday, February 14, 2019 11:25 AM

All replies

  • Implement what?  Your question is way too vague and your code makes no sense.  What is it supposed to do?


    \_(ツ)_/

    Thursday, February 14, 2019 11:41 AM