RSGs “One-Liners”

This page features some of MY most used one-liners. It could be SQL queries, Powershell scripts or any other SCOM related one-liner.


(Powershell)

List all SCOM objects in Maintenance Mode on a single server (run from server)

$server = (Get-WmiObject win32_computersystem).DNSHostName + “.” + (Get-WmiObject win32_computersystem).Domain
Get-SCOMMonitoringObject | where-object {$_.InMaintenanceMode -eq $true} | where-object {$_.DisplayName -eq $server}


(Powershell)

List all SCOM objects in Maintenance Mode

Get-SCOMMonitoringObject | where-object {$_.InMaintenanceMode -eq $true}


(SQL Query)

Set all SCOM agents to Remote Manageable

UPDATE MT_HealthService
SET IsManuallyInstalled=0
WHERE IsManuallyInstalled=1


(Powershell)

List all alerts generated by a rule

get-scomalert -criteria ‘ResolutionState = ”0”’ | where-object {($_.IsMonitorAlert -eq $False)}

Advertisements