Copy this script into a .vbs file. Edit line 15 (objAlert.TimeRaised = "xxxxxxxx245959"). Replace xxxxxxxx with YearMonthDay (ex: 20080401). TimeRaised is a Date/Time stamp. The 245959 simply means 12:59:59pm. So, any alert raised on or before this date will be updated to a "Resolved" state. Run this on a MOM 2005 Management Server.
Set objWMI = GetObject("winmgmts://./root/MOM")
strQuery = "select * from MSFT_Alert where ResolutionState <> 255"
Set colAlerts = objWMI.ExecQuery(strQuery)
For Each objAlert In colAlerts
If Len(Trim(objAlert.AlertHistoryComment)) = 0 Then objAlert.AlertHistoryComment = Null
If Len(Trim(objAlert.CustomField1)) = 0 Then objAlert.CustomField1 = Null
If Len(Trim(objAlert.CustomField2)) = 0 Then objAlert.CustomField2 = Null
If Len(Trim(objAlert.CustomField3)) = 0 Then objAlert.CustomField3 = Null
If Len(Trim(objAlert.CustomField4)) = 0 Then objAlert.CustomField4 = Null
If Len(Trim(objAlert.CustomField5)) = 0 Then objAlert.CustomField5 = Null
If Len(Trim(objAlert.Description)) = 0 Then objAlert.Description = Null
If Len(Trim(objAlert.OwnerName)) = 0 Then objAlert.OwnerName = Null
If Len(Trim(objAlert.ResolvedBy)) = 0 Then objAlert.ResolvedBy = Null
If Len(Trim(objAlert.TimeResolved)) = 0 Then objAlert.TimeResolved = Null
If ObjAlert.TimeRaised <= "xxxxxxxx245959" then
objAlert.ResolutionState = 255
If we execute an Update query to the OnePoint DB directly, we are essentially circumventing MOM from performing it’s normal Alert update process and some interesting fields (like TimeResolved, ResolvedBy, etc) will not be updated properly. This is why it’s recommended to use this method if the console will not suffice.
Also, a note about updating particular blank fields in the script to NULL. If these blank fields are not updated to NULL, the script will fail. This is not a SQL or MOM issue. It’s a problem with SWBemObjectEx. Blank fields cannot be handled. Specifically, you’ll receive the following error: