title: Pass array to PowerShell script executed with -File argument
body: <p>I have simple script which takes array argument:</p>
  
  <pre><code>param(
      [Parameter(Mandatory=$true)]
      [string[]]$keys
  )
  
  for ($i = 0; $i -lt $keys.Length; ++$i) {
      Write-Host "$i. $($keys[$i])"
  }
  </code></pre>
  
  <p>I need to execute it via powershell with -File argument (in order to address a TeamCity bug) like so:</p>
  
  <pre><code>powershell.exe -File Untitled2.ps1 -keys a
  </code></pre>
  
  <p>How can I pass parameter as array to my script? As long as I pass single key it works well, but it don't want to take more than one element.</p>
  
  <p>I tried following among others:</p>
  
  <pre><code>powershell.exe -File Untitled2.ps1 -keys a,b
  powershell.exe -File Untitled2.ps1 -keys:a,b
  powershell.exe -File Untitled2.ps1 -keys $keys # where $keys is an array
  </code></pre>
  
  <p>Whatever I'd tried either I have "A positional parameter cannot be found" error, or all keys are joined in first array element.</p>
  
  <p>Any ideas?</p>