title: PowerShell pass array as a reference
body: <p>I'm building a menu and want to pass an array to a function as a reference.</p>
  
  <p>When I'm passing just the reference everything works fine. But when I want to pass a second parameter, it won't work with an "ParameterBindingArgumentTransformationException". And I do not understand why.</p>
  
  <p>Here is the - working- minimal code:</p>
  
  <pre><code>function Menu {
      param([Ref]$mi)
      Write-Host "var"
      Write-Host $mi.value[0].cmd
      Write-Host $mi.value[1].desc
      Write-Output 0
  }
  
  
  function MainMenu {
      $mm = @(@{desc='Windows Tools';cmd='WinToolsMenue'},
              @{desc='copy setup.exe';cmd='setupexe'},
              @{desc='gpupdate (Policy)';cmd='cmd /c gpupdate /force'},
              @{desc='Exit';cmd='break'})
      $a = Menu([Ref]$mm)
  }
  
  &amp; MainMenu
  </code></pre>
  
  <p>The problem-code:</p>
  
  <pre><code>function Menu {
      param([Ref]$mi, $b)
      Write-Host $b
      Write-Host $mi.value[0].cmd
      Write-Host $mi.value[1].desc
      Write-Output 0
  }
  
  function MainMenu {
  
      $mm = @(@{desc='Windows Tools';cmd='WinToolsMenue'},
              @{desc='copy setup.exe';cmd='setupexe'},
              @{desc='gpupdate (Policy)';cmd='cmd /c gpupdate /force'},
              @{desc='Exit';cmd='break'} )
      $mm
  
      $a = Menu([Ref]$mm, "b")
  }
  
  &amp; MainMenu
  </code></pre>
  
  <p>Almost tried ([Ref]$mi), $b or ([Ref]$mi, $b), but it won't work. Someone out there who knows what I'm doing wrong?</p>