title: Add menu options in a running powershell script
body: <p>I am using a PowerShell script with an interactive console menu that uses functions in the switch part. looks like this:</p>
  
  <pre><code>function startmenu {
      do {
          [int]$selection = 0
          while ($selection-lt 1 -or $selection-gt 5){
              Write-Host "1. Search"
              write-host "2. Change"
              Write-Host "3. do stuff"
              write-host "4. Clear Screen"
              write-host "5. Exit"
  
              [int]$selection= read-host "choose one option"
              switch ($selection) {
                  1{find}
                  2{change}
                  3{dostuff}
                  4{cls}
                  5{exit}
              }
          }
      }
      while ($selection -ne 4)}
  </code></pre>
  
  <p>Right now I am trying to build a new script with a similar menu for ssh connections. 
  Since PowerShell has its own ssh client. 
  Sometimes you have to add new servers to your server list, 
  like putty or something. So I want to add new options to my menu while running the script. 
  maybe with a function "add a new server to list". 
  But I have no idea how to realize this. 
  my colleagues would use this scrip as well and they may have other servers so the menu has to be some kind of 
  dynamic for every user of it.
  Everyone should build their own list without touching the script.</p>
  
  <p>Is there any possible way? my PowerShell knowledge is pretty basic.</p>
  
  <p>Thanks!</p>