Sometimes it’s necessary to launch a custom script or other action after an alert is detected. This can be all executable scripts or programs.

In my particular case I’m using this to launch scripts when an alert is detected to properly escalate the alert and perform additional tasks on the alert.

So how do you make sure that the script you intend to run will actually run when a predefined alert is raised?

By creating a Command notification channel and subscription…

Let’s start with setting up the command notification channel.

Note: I’m using my script Create_Ticket.Ps1 as documented here. The parameters I’m passing are useful for this script but you can pass many more parameters according to your needs.

First of all open the Notification Channels by opening the SCOM console > administration > Notifications > Channels


Right click in the Right pane > choose New > Command…


In the settings tab you need to fill in what you prefer to run:

  • Full Path of the command file: In my case this is PowerShell as I would like to run a PowerShell script
  • Command Line Parameters: In my case I’m running a PowerShell script and I’m passing the AlertID of the specific alert as an argument which I’m using in my script. Again you can use any arguments here if you like.
  • Startup folder for the command line: This is basically the path of your program you want to run.

Click Finish.


At this point your Command Notification Channel is set up. The next thing you need to configure is the trigger which will run this Command Notification Channel. This is done by creating a Subscriber:

Open the Scom console and navigate to Administration > notifications > Subscribers


Right click in the right pane and choose New…


Fill in a name for the Subscriber


Leave the “always send notifications” or specify a time window (ex. during business hours only) and click next.


Click Add to ad a subscriber address to the list. The following window appears:


Fill in the address name and click next


  • Channel Type: Select Command in the drop down list
  • Command Channel: Select the previously created Channel in this case it’s “Ticket” from the drop down list.
  • Click Next


Leave the always send notifications setting or change according to your needs.


Click Finish and you have configured your Command to run whenever you subscribe to an alert with this channel.


  • Dipan

    Hi Dieter

    Excellent article, thanks for that. I have got a question which I can’t find an answer to.
    I have got a script(I didn’t write it), which looks at the names of certain alerts and then changes it on SCOM 2012. I have created the it looks like the following:

    param ($rootMS)
    #Initializing the Ops Mgr 2007 Powershell provider
    add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client” -ErrorVariable errSnapin ;
    set-location “OperationsManagerMonitoring::” -ErrorVariable errSnapin ;
    new-managementGroupConnection -ConnectionString:$rootMS -ErrorVariable errSnapin ;
    set-location $rootMS -ErrorVariable errSnapin ;

    $Alerts = get-alert -criteria ‘Name = ”IIS 7 Web Site is unavailable”’ | Where {$_.ResolutionState -eq 0}
    foreach($Alert in $Alerts)
    {$Alert.ResolutionState = 20
    $Alert.Update(“Resolution State Changed”)}

    It works when I run it from the powershell window but doesn’t seem to work from the command channel i.e, the alerts get changed when I run it manually it works and the . My command channel looks like this:

    Full path of the command line:
    Command line parameters:
    “C:\Temp\ChangeResState_IIS.ps1” ‘$Data/Context/DataItem/AlertId$’
    Startup folder for the command line:

    I have also tried C:\Temp\ChangeResState_IIS.ps1 and C:\Temp as the Command line parameters:and Startup folder for the command line:without any luck.

    I think the command line parameter might be wrong. Also should the startup folder be what it is or should that be changed. I am new to SCOM and powershell, please help?

    Thanks in advance.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.