First published on TECHNET on Dec 14, 2017
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
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
Updated Mar 11, 2019
Version 4.0System-Center-Team
Former Employee
Joined February 14, 2019
System Center Blog
Follow this blog board to get notified when there's new activity