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:
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
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.