Example PowerShell SCOM Scripts

Even though we believe our System Performance and Sizing Site is easier to setup, maintain and use than Microsoft’s System Center Operations Manager, some of our customers also require the advanced monitoring that SCOM provides. Note that ALL of our customers that we help setup/maintain SCOM also fully utilize SPASS.

System Center Operations Manager can be daunting to maintain, these PowerShell SCOM scripts should aid you in maintaining your SCOM system. If you find this information useful or utilize any of these scripts in a Production environment, please support us by purchasing one of our Products.

All of these scripts require that you first import the SCOM PowerShell Module and connect to your SCOM Management Servers.

Management Scripts

SCOM Backup Management Packs – this script will backup your installed Management Packs into Zip Files (requires 7-zip)

SCOM ServerList Maintenance Mode – this script will put a list of servers into Maintenance Mode. This is useful for servers that haven’t been “pingable” for days/weeks.

Alert Resolution Scripts

SCOM Close Old Rule Alerts – basic SCOM script to close Rule alerts after X hours.

SCOM Reset Monitoring Alerts by Name – Allows you to automatically close Monitoring Alerts by providing the Alert’s DisplayName.

SCOM Reset App/SysLog Monitors – This script will reset Monitors that are generated by Application / System Log Entries that are older than X Hours. Most App/SysLog Monitors should be Rules, but some Management Packs use Monitors that never auto-reset (i.e. SharePoint).

SCOM Reset Fragmentation Alerts – This script will reset all Disk Fragmentation alerts. Since SCOM 2012R2 disables the Disk Fragmentation monitors by default this is usually not used, but if you enabled the monitor this will help keep your alerts clear (especially if you auto-defrag the disks when the alert triggers).

SCOM Reset Improperly Closed Monitor Alerts – This script will reset any monitor alert that was not closed by the SCOM System. This helps if someone closes a monitor alert without resetting the monitor.

Reporting Scripts

SCOM Group Monitor Report – this script will create an Excel document that lists all the monitors for every server in a SCOM Group (each server’s monitors is listed in a separate worksheet)

SCOM Report for DBA Issues – this script will email a report showing the active DB/SQL Issues.

SCOM Report for Daily Changes – this script will email a report showing the Daily changes made to the SCOM system. Hint: you can easily use this for weekly changes as well.

Caveats

Note that if you run the scripts that use Microsoft Office as scheduled tasks, you must ensure that the “Default Profile” directories that MS Office use are created.

Use all these scripts at your own risk – we will not provide support for these scripts unless you engage our consulting services.