The below PowerShell script can be used to automatically close old SCOM alerts. This script looks for active alerts along with the time when alert was created (alert age). If the alert age is greater than the specified number of days ($alertsTobeClosedBefore) then the script will close the alert for you. This script can help clean up some environments with lot of old alerts which are still active.
Script:
$alertsTobeClosedBefore = 5
$currentDate = Get-Date
Get-SCOMAlert | Where-Object {(($_.ResolutionState -ne 255) -and (($currentDate – $_.TimeRaised).TotalDays -ge $alertsTobeClosedBefore))} |Resolve-SCOMAlert