title: How can I import a .csv into multiple arrays in a simpler way?
body: <p>I am new to powershell and am writing my first somewhat complicated script.  I would like to import a .csv file and create multiple text arrays with it.  I think that I have found a way that will work but it will be time consuming to generate all of the lines that I need.  I assume I can do it more simply using foreach-object but I can't seem to get the syntax right.</p>
  
  <p>See my current code...</p>
  
  <pre><code>$vmimport = Import-Csv "gss_prod.csv"
  $gssall = $vmimport | ForEach-Object {$_.vmName}`
  $gssweb = $vmimport | Where-Object {$_.tier -eq web} | ForEach-Object {$_.vmName}
  $gssapp = $vmimport | Where-Object {$_.tier -eq app} | ForEach-Object {$_.vmName}
  $gsssql = $vmimport | Where-Object {$_.tier -eq sql} | ForEach-Object {$_.vmName}
  </code></pre>
  
  <p>The goal is to make 1 group with all entries containing only the vmName value, and then 3 separate groups containing only the vmName value but using the tier value to sort them.</p>
  
  <p>Can anyone help me with an easier way to do this?</p>
  
  <p>Thanks!</p>