Morning Check SCOM Alerts – Automated using PowerShell Script
One of my clients has a centralised SCOM management group for different segments of the business. The BAU team’s support hours are 8am-6pm Monday - Friday. They are also required to perform a morning check Monday - Friday and manually log service desk calls based on the SCOM alerts generated after hours.
I wanted to automate the process (at least to generate a list of alerts that were raised since 6:00pm previous night). We firstly had a look at the Alerts report from SCOM Generic Reports library but it did not meet our requirements as it does not include the alert resolution state in the report.
We have the following requirements to accomplish:
- Include any warning and critical alerts generated between 6:00pm previous BUSINESS day and 7:30 present day.
- Only include alerts that are still open (resolution state not equals to 255)
- Only include production servers from a specific domain
- Time Raised is displayed as the local time, not GMT standard time
- List is emailed out every morning
As my knowledge in SQL reporting is very limited, I achieved the task using below PowerShell script. It is scheduled in Task Scheduler of the SCOM RMS server to run Monday – Friday.
Note: a SCOM group is required to include all servers in the scope (in this case, all production servers from the particular domain).
Here’s the script.
Leave a comment