PowerShell Script to determine if database is online/offline

  • I have created a powershell script to loop through a file of servernames listing each database and whether or not that it is online or not. However, my question is, what SMO property do I reference, "State" or "Status?" I have looked through the object model of SMO for Powershell but it is not really plain or clear which one to reference. My goal is to list the database name and then a status of whether the database is "online/offline."

    Hope this makes sense.

  • I have discovered the answer to my own question. In looking back at what I found and asking that question I feel rather stupid. Thank you to all that at least had a look at my question.

  • I don't know what your needs are, but have you considered querying the instance for the list of DBs and then traversing through the result set to see which ones are open? It would eliminate the possibility of the file with DB names being out of date.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply