views:

28

answers:

0

I have a SQL 2008 Ent server with the databases "DBOne", "DBTwo", "DBThree" on the server DEVSQLSRV.

Here is my Powershell script:

$DBNameList = (Invoke-SQLCmd -query "select Name from sysdatabases" -Server DEVSQLSRV)

This produces my desired list of database names as:

Name
-----
DBOne
DBTwo
DBThree

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:

$DBNameList -contains 'DBTwo'

It comes back has "False" instead of "True" which is leading me to believe that my list is not an actual array.

Any idea what I'm missing here?

Thanks so much!

Emo