title: Return SQL Query as Array in Powershell
body: <p>I have a SQL 2008 Ent server with the databases "DBOne", "DBTwo", "DBThree" on the server DEVSQLSRV.</p>
  
  <p>Here is my Powershell script:</p>
  
  <pre><code>$DBNameList = (Invoke-SQLCmd -query "select Name from sysdatabases" -Server DEVSQLSRV)
  </code></pre>
  
  <p>This produces my desired list of database names as:</p>
  
  <pre><code>Name
  -----
  DBOne
  DBTwo
  DBThree
  </code></pre>
  
  <p>I has been my assumption that anything that is returned as a list is an Array in Powershell.  However, when I then try this in Powershell:</p>
  
  <pre><code>$DBNameList -contains 'DBTwo'
  </code></pre>
  
  <p>It comes back has "False" instead of "True" which is leading me to believe that my list is not an actual array.</p>
  
  <p>Any idea what I'm missing here?</p>
  
  <p>Thanks so much!</p>
  
  <p>Emo</p>