title: Passing an array as parameter from CMD to PowerShell give problems
body: <p>I have problems to pass an array to PowerShell script as parameter from CMD.
  Here an example of the PS code:</p>
  
  <pre><code>[CmdletBinding()]
  Param(
      [string[]]$serverArray,
  )
  
  $serviceName = 'service1'
  
  function getState {
      Process {
          $serverArray
          foreach ($server in $serverArray) {
              $servState = (Get-WmiObject Win32_Service -ComputerName $server -Filter "name='$serviceName'").State
          }
      }
  
  getState
  </code></pre>
  
  <p>How I call script from CMD:</p>
  
  <pre><code>powershell -file .\script.ps1 -serverArray Server1,Server2
  </code></pre>
  
  <p>I get an error because <code>$serverArray</code> is not passed an array:</p>
  
  <pre>
  Server1,Server2
  Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
  0x800706BA)
  At C:\script.ps1:58 char:29
  +             $servState = (Get-WmiObject &lt;&lt;&lt;&lt;  Win32_Service -ComputerName $server -Filter "name='$serviceName'").State
      + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMException
      + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
  </pre>
  
  <p>If I run the same command from a PowerShell window it works because the script accepts <code>$serverArray</code> as an array:</p>
  
  <pre><code>.\script.ps1 -serverArray Server1,Server2
  </code></pre>
  
  <pre>
  Server1
  Server2
  </pre>