Blog Post

System Center Blog
1 MIN READ

PowerShell script to automatically close old alerts in SCOM

System-Center-Team's avatar
System-Center-Team
Former Employee
Feb 16, 2019
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
Updated Mar 11, 2019
Version 4.0
No CommentsBe the first to comment