If you need to change the Resolution State when a new Alert appears, or change the status of an alert from a specific source or a given period of time, it could be done with a script. The script will be called by creating a Notification. Often you specify a SMTP, SMS or IM as a Channel but lets instead call a script – In this sample I will use a Powershell script to change new alerts Resolution state to the “Print Guys”.
Lets start with creating a Command Notification Channel – Give it a name like this one:
Start your Operations Manager Console, choose Administration and right click [Notifications] like….:

New Channel

image
Click new Command…
image
Click [Next]
image
And [Finish]

New Alert State

To create a new alert
Choose Settings and Properties on Alerts.
image
Click [New] and add a New Resolution State, give it an ID which will be used for your script to change a default alert value of 0 New.
In generel try to categorize your Alert ID it could be you one day would create a query of all alerts id between 90-100. So try to create your alerts in a value range like:
Hardware ID 31-60
Software ID 61-100
SNMP ID 101-110
image
Create your Script – This sample script could be divided in three parts – First you parameters – could drop them – but it’s easier to read the changes and reuse the script. Second part is your initialization of your Powershell Provider so you are able to run the script from a powershell shell. Last part is changing all resolution states of all alerts which is included in your clause.
Paste this script into your file – in this sample it is the c:\scripts\PrintGuys.ps1 and save close it.
*********************** Script ************************
$rootMS = “STO-RMS”
$ResolutionState = 90
#Initializing the Ops Mgr 2007 Powershell provider
add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client” ;
set-location “OperationsManagerMonitoring::” ;
new-managementGroupConnection -ConnectionString:$rootMS ;
set-location $rootMS ;
$Alerts = get-alert -criteria ‘Name = ”Windows Service Stopped”’ | Where {$_.ResolutionState -eq 0 -and $_.Description -like ‘The ”Print Spooler” service on computer STO-RMS.contoso.msft has stopped running’}
foreach($Alert in $Alerts)
{
$Alert.ResolutionState = $ResolutionState
$Alert.Update(“Resolution State changed automatically by the notificator”)
}
The last thing is to create a Subscription which is running everytime your alert show up. This sample will change the Windows Service Stopped Alert.
image
Right Click your Alert and choose: Create Notification Subscription
image
Give it a Name and click [Next]
image
Remember your Wildcards when you use Description
image
Add a Subscriber address – Call it e.g. Script Notification
image
image
image
Click [Finish] and Voila – from now on your Alerts are automatically being changed to your Resolution States.
image
Try and work with different script and Alerts – OpsMgr Rules ..;-)