How to enable HTML email notifications in SCOM
Enrich your email notifications from SCOM by enabling HTML content within your notification bodies.
Overview
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 DS.
- 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.
This procedure does not require SquaredUp DS, as this functionality is available out of the box with SCOM.
You may also like to take a look at the SquaredUp DS webinar 'Enabling HTML email notifications':
Procedure
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.
Download the script
- Browse to the SquaredUp public scripts repository on github and click on
New-SCOMHtmlNotificationChannel.ps1
. - 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.
Execute the script
- 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:
If when attempting to run the script you receive a warning about your execution policy, you may need to run the Set-ExecutionPolicy
cmdlet to modify your settings. For more information on PowerShell Execution policies, see About Execution Policies.
For full details on all parameters and examples of using the script, run Get-Help .\New-SCOMHtmlNotificationChannel.ps1 -full
from PowerShell
Provide SMTP options
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.
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 '[email protected]'
Copy settings from an existing channel
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'
Configure email links to use SquaredUp DS
By default, links within the alert body will use the SCOM Web Console URL configured inside SCOM. If you wish to instead use SquaredUp DS, you can specify the -SquaredUpURL
parameter and provide a URL to a SquaredUp DS 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/SquaredUp'
to your command.
Configure emails to be sent with high importance
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.
Making changes
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.