SQL | I do stuff sometimes.

Ramblings about things.

Archives

SCOM: Get Maintenance Mode History


I use this query whenever I need to investigate Maintenace Mode history for SCOM agents. USE OperationsManagerDW SELECT ManagedEntity.DisplayName, MaintenanceModeHistory.* FROM ManagedEntity WITH (NOLOCK) INNER JOIN MaintenanceMode ON ManagedEntity.ManagedEntityRowId = MaintenanceMode.ManagedEntityRowId INNER JOIN MaintenanceModeHistory ON MaintenanceMode.MaintenanceModeRowId = MaintenanceModeHistory.MaintenanceModeRowId where DisplayName Like ‘%SERVERNAME%’ order by ScheduledEndDateTime – F

Read More

Useful SQL queries for OpsMgr DB


Here are some of the SQL scripts I usually use in case of… whatever. Many of these must be credited to Kevin Holman Set ALL agents to Remotely Managable UPDATE MT_HealthService SET IsManuallyInstalled=0 WHERE IsManuallyInstalled=1 Get Agents not Remotely Managable select bme.DisplayName from MT_HealthService mths INNER JOIN BaseManagedEntity bme on bme.BaseManagedEntityId = mths.BaseManagedEntityId where IsManuallyInstalled…

Read More

Query MSSQL with Powershell


I often use different variety of this snippet to do stuff with MSSQL databases (and other types as well, with minor changes to the script). The script will use SQL Auth by default. To change this to Windows Auth, change the Connection String to: $SqlConnection.ConnectionString = “Server = $SQLServer; Database = $SQLDBname; Integrated Security =…

Read More

  • Archives