Enrich your email notifications from SCOM by enabling HTML content within your notification bodies.
By default any SMTP notification channels created in SCOM are sent in a plain text format. This can lead to confusing, ugly alert notifications that are difficult to read and do not easily lend themselves to follow-up actions (such as viewing further information on the alert in a web browser).
By following this article you can enable SCOM notification channels that are capable of sending HTML formatted emails. The emails sent using these channels:
- Are formatted more clearly than the default SCOM emails.
Contain a link to view the alert itself and the object that raised the alert in a web browser.
- This can be the SCOM Web Console, or SquaredUp.
- Can optionally be sent using HTML format, making them even easier to read and faster to interpret.
- Can optionally be sent with high importance flags (marking them as important in your email client).
For more information about configuring email notifications in SCOM, you should read Kevin Holman's blog OpsMgr 2012: Configure Notifications.
You may also like to take a look at the SquaredUp webinar 'Enabling HTML email notifications':
We have put together a PowerShell script that allows you to create SCOM notification channels with the
IsBodyHtml SDK setting enabled, and optionally with importance flags set. The script can either create a brand new channel from scratch, or copy settings from an existing channel.
- Browse to the SquaredUp public scripts repository on github and click on
- Right click on the Raw button and select Save link as... to download the script to your system.
- Browse to where the script was saved on your system, right-click on the script and select Properties.
- If the unblock checkbox is visible at the bottom of the properties window, check the box and click on OK.
- In order to run the script, you will need to have an active SCOM Management Group connection in your PowerShell session. The easiest way to do this is to open the Operations Manager Shell: Start > Microsoft System Center > Operations Manager Shell (which is available anywhere you have the SCOM console installed). If you are logged on to a management server, the SCOM shell will connect locally. If you are logged on to your workstation, you will be prompted for a SCOM server to connect to.
- Navigate to the folder where you saved the script.
Execute the script by typing
.\New-SCOMHtmlNotificationChannel.ps1, using either of the two options detailed under the following headers:
Set-ExecutionPolicy cmdlet to modify your settings. For more information on PowerShell Execution policies, see About Execution Policies.
Get-Help .\New-SCOMHtmlNotificationChannel.ps1 -full from PowerShell
This set of parameters allow you to create a new channel with no existing configuration required in SCOM. To specify each parameter add
-ParameterName Value to the script command, where ParameterName is the name of the parameter and Value is the value you wish to set.
The table below specifies each parameter available, its effect, and what the default value is (if any) if omitted.
|SMTPServerFQDN||String||The name of the email server that notifications should be sent to. Mandatory.|
|SMTPFromAddress||Email Address||The email address that notification mails should originate from, and the Reply To address. Mandatory.|
|SMTPServerPort||Integer||The port number the SMTP server is listening on. Defaults to 25 if unspecified.|
|SMTPRetryMins||Integer||The number of minutes between send attempts should a failure occur. Defaults to 5 if unspecified.|
|SMTPAuthentication||String||The SMTP server's authentication mechanism. Can be Anonymous or Ntlm. Defaults to Anonymous if unspecified.|
As an example, if you are happy to accept the default values you would run the command:
.\New-SCOMHtmlNotificationChannel.ps1 -SMTPServerFQDN 'smtp.contoso.local' -SMTPFromAddress 'SCOMAlerts@contoso.com'
This set of parameters allow you to use an existing channel's SMTP and encoding settings. Any future changes made to the original channel will also apply to the newly created channel.
To use this option, simply specify the
-BaseSmtpChannel parameter with either the name of the channel you want to clone (as shown in the SCOM console under Administration -> Notifications -> Channels) or the Id value retrieved from the SDK.
As an example, if you wanted to copy the settings from the channel "Default SMTP" you would run
.\New-SCOMHtmlNotificationChannel.ps1 -BaseSmtpChannel 'Default SMTP'
By default, links within the alert body will use the SCOM Web Console URL configured inside SCOM. If you wish to instead use SquaredUp, you can specify the
-SquaredUpURL parameter and provide a URL to a SquaredUp install.
As an example, if you wanted to direct users to the SquaredUp server installed on "squaredup.contoso.local" using the default virtual directory, you add
-SquaredUpURL 'http://squaredup.contoso.local/SquaredUpv4' to your command.
As an option, you set all emails sent by the channel to be flagged in email clients as High Importance by adding the
-HighImportance switch to your command (you don't need to specify a value.)
If you want to only send certain emails as important (such as only Critical alerts ) you can run the script twice to create two channels, and only mark one as high importance, to be used by critical alert subscriptions. The channel will automatically have "High Importance" added to the name.
Once created, you can freely edit the channel from within the SCOM console (under Administration -> Notifications -> Channels) without losing any functionality. You will not be able to add/remove the high importance flags from within the SCOM console or via this script.