title: Passing an array to a PowerShell script
body: <p>I am trying to pass an array to a PowerShell script, but I always get just one value. I have googled my butt off, but I can't find anything. All I need to do is pass an array to the script. Here is my code:</p>
  
  <pre><code>param($Location)
  ($location).count
  
  Foreach ($loc in $Location)
  {
  
  $loc
  
  }
  </code></pre>
  
  <p>Here is my command I am running:</p>
  
  <pre><code>C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Unrestricted  -File "C:\ParaTestingArray.ps1" -location Sydney,London
  </code></pre>
  
  <p>Here is the output:</p>
  
  <blockquote>
    <p>1 <br/>
    Sydney</p>
  </blockquote>
  
  <p>For the life of me I can't get it to grab the other value in the array. I have tried using</p>
  
  <pre><code>param([string[]]$Location)
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>-location "Sydney","London"
  -location @(Sydney,London)
  -location Sydney London
  -location Sydney,London
  -location (Sydney,London)
  </code></pre>
  
  <p>What am I doing wrong?</p>