On occasion, it may be necessary for a SCOM administrator to perform a specific action when an alert is detected. This can be accomplished by launching a custom script 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 I wanted to show how to make sure that the script you intend to run will actually run when a predefined alert is raised. This example shows how to create a Command notification channel and subscription…
Let’s start with setting up the command notification channel.
Note: I used a simple ps1 script which would generate a service ticket.The script and parameters would be based on your specific needs and passed to the subscription in the same format.
First, open the Notification Channels by opening the SCOM console > administration > Notifications >
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 this case, this is the PowerShell script I wish to run.
- Command line parameters: Parameters required by your script to execute.
- Startup folder for the command line: This is the path of the program you want to run.
- Click Finish.
The Command Notification Channel is now set up.
Next, you will need to configure 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 then choose New…
Fill in a name for the Subscriber.
Select “always send notifications” or specify a time window (ex. during business hours only) and click next.
Click Add to add 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
Click Finish and you have configured your Command to run whenever you subscribe to an alert with this channel.
We hope you enjoyed this short recap on creating command notifications and subscriptions.
To learn more about Directions’ System Center course offerings, Click Here or contact us at 855.575.8900!