listing the offline databases that are monitored by SCOM2012


  • Hi,

    We have about 80 sql-servers that are monitoresd with scom2012. I need a list of all databases that are offline on our sql-servers. Does some body know about a powershell script or way in SCOM that discovers all offline databases and list them?

    Saturday, September 21, 2013 8:57 PM


  • run the following PowerShell script (add the SQL Instance names to C:\temp\SQL_servers.txt file), after running it, C:\temp\OfflineDBs.txt will list the offline DBs names

    ForEach ($instance in Get-Content "C:\temp\SQL_Servers.txt")
           [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null
           $s = New-Object ('Microsoft.SqlServer.Management.Smo.Server') $instance  
           foreach ($DB in $dbs)
           {if ($DB.status -eq 'offline' ) {add-content C:\temp\OfflineDB.txt $ }}

    check the following link to get the full list of the DB Status names

    Sunday, September 22, 2013 1:56 AM