I hade a customer that wanted to get mail notifications from SCOM and the default mail channel isn’t the best in formatting and giving you the right information.
So after some looking around I’ve found this great PowerShell script (http://blog.tyang.org/2010/07/19/enhanced-scom-alerts-notification-emails/) written by Tao Yang that formats the notification mail in the same way as you see in the console.
So me and my good friend Peter at https://syscenramblings.wordpress.com/ found some things we wanted to modify in the script to fit our needs.
The things we modified was:
- The web console link
- Web links in knowledge articles
- Knowledge articles languages
Web console link
We added a function that checks if there is a web console link in the management group or not If there is one we add the link to the Alert in the mail otherwise there is no link at all.
Web links in KB’s
Another feature we added was to have clickable web links in the knowledge articles. Because the mail already is in HTML format we thought that it would be nice to be able to follow the links directly from the mail instead of doing copy and paste to a web browser.
Knowledge articles languages
Another feature we added was the possibility to choose you language for the knowledge articles. This due to that you may not want to get every language in your emails like this:
We added the feature to choose your language or get them all. If you want to get just specific languages you need to get the short name for the language, for English it’s ENU.
To just get English you run the script like this in the Command Notification Channel with the language parameter set to ENU:
PowerShell.exe -Command "& '"E:\Script\SCOMMail\SCOMEnhancedEmailNotification.ps1"'"
-alertID '$Data/Context/DataItem/AlertId$' -Recipients @('HelpDesk;email@example.com') –Languages ENU
If you want to run the script with all languages the languages parameter needs to be set to ALL:
PowerShell.exe -Command "& '"E:\Script\SCOMMail\SCOMEnhancedEmailNotification.ps1"'" -alertID '$Data/Context/DataItem/AlertId$' -Recipients @('HelpDesk;firstname.lastname@example.org') –Languages ALL
This is how it looks in the Command Notification Channel:
To configure the script please follow Tao’s original post:
The script can be downloaded at: https://1drv.ms/u/s!AsVfLv6C271rhqNnVAXSUKbjYf4HaA
I hope that this can add some functions that you may want in your SCOM mail notifications