title: powershell.exe -file string array as parameter
body: <p>I'm actually writing a plugin with powershell for a monitoring solution.</p>
  
  <p>This monitoring solution runs the powershell skript from the command line cmd.</p>
  
  <p>One of the input parameters is a string array but it looks  like cmd can't hand over the array to the powershell.</p>
  
  <p>Here a example script that I've wrote to explain you the problem:</p>
  
  <pre><code>param (
      [array]$myarray
  )
  
  Write-Host 'My array is a ' $myarray.GetType()
  Write-Host 'How much value do I have in my array?' $myarray.count
  Write-Host 'My content is' $myarray
  </code></pre>
  
  <p>When I run this script from a powershell console my output is right:</p>
  
  <pre><code>.\Test-Script.ps1 -myarray bla1, bla2
  
  My array is a  System.Object[]
  How much value do I have in my array? 2
  My content is bla1 bla2
  </code></pre>
  
  <p>now I run the same from the cmd and the array is not interpreted as it should:</p>
  
  <pre><code>powershell.exe -file Test-Script.ps1 -myarray bla1, bla2
  
  My array is a  System.Object[]
  How much value do I have in my array? 1
  My content is bla1,
  </code></pre>
  
  <p>My question is now how to commit the array to the powershell script? I have tried quite every thing....
  Escaping with ^ , brackets, sing quotes , double quotes and so on. but nothing helped...</p>
  
  <p>I am thankful for every hint :)</p>