Resolve Alerts older than x hours for Specific Rule / Specific Severity

I did something similar to this

yesterday but targeting a specific rule called “LMS Alert” and closing all alerts that aren’t Closed/255 and are older than 6 hours.

The script which is a build on from another chaps work (, allows for filtering based on severity but it is hashed out in this example because I don’t need it (but you might?).

I hope it is helpful to others, note that you need to read the notes in the script, and any comments to streamline are very welcome!!

After download rename the extension ps1. Run from a Scheduled task by creating a cmd with one line

powershell -command “& ‘c:\Path\Resolve6HrsSpecificRule.ps1’ “