Configure Email Notification for Windows Server Backup
Windows 2008, R2 and 2012 all include the Windows Server Backup feature, which is a reliable but basic backup utility. This allows you to schedule complete server backups allowing you to restore data or the entire server as necessary. There is however one glaring omission in WSB and that is the lack of a reporting function. It is essential to us that we can see at a glance the status of our server backups so that any failures are addressed immediately without compromising the data protection scheme. WSB doesn’t natively allow you to configure notification emails that advise on the success or failure of each backup. Since this is a feature that’s very important to us, we’re going to show you how to achieve this using scheduled tasks with event triggers.
Windows Server Backup writes operational events to its own event log, situated at event Logs > Applications and Services Logs > Microsoft > Windows > Backup > Operational. Successful or unsuccessful completion of the backup is logged here, so we can use these events as triggers to send a ‘success’ or ‘failure’ email to the designated backup admin. To the task scheduler Batman!
The aim here is to trigger the notification on backup completion. It’s more practical to set up two tasks, one triggered by failure events and one by success events. Click on ‘Create Task’ and configure as follows:
- Name: Backup Success Email Task
- Description: Notifies backup admin of scheduled backup successful completion
- Run whether user is logged on or not
- Trigger > On event > Log=Microsoft-Windows-Backup/Operational > Source=Backup > Event ID(s)=4
- Action: Send an email [configure email settings, subject, body etc as required]
Save this task and then create another task to be triggered on backup failure. This one has a larger event trigger, as there are multiple backup failure event codes whereas there is only one backup success event code (4). Configure the task as follows:
- Name: Backup Failure Email Task
- Description: Notifies backup admin of scheduled backup failure
- Run whether user is logged on or not
- Trigger > On event > Log=Microsoft-Windows-Backup/Operational > Source=Backup > Event ID(s)= 5,8,9,17,22,49,50,52,100,517,518,521,527,528,544,545,546,561,564,612
- Action: Send an email [configure email settings, subject, body etc as required]
Since this is just a basic notification of success or failure, the email doesn’t contain details of the failure, just an exhortation to go find out what’s wrong and fix it!
NOTES:
- There is also a Powershell method for scripting windows server backups and emailing the results. See here: http://gallery.technet.microsoft.com/scriptcenter/WSB-Backup-network-email-9793e315
- If you need to send through an authenticated mail server (such as Office 365 or Google Apps, for example because you want to send the notifications outside your domain, you’ll need to combine these instructiosn with our instructions for setting up an SMTP Relay here.




I tried to set this email notification up on my windows server 2012 standard and got a notice at the end saying the email function was deprecated. Is there another method to get this done? Thanks
Hi Ken,
It’s unfortunate that this feature is deprecated – we’ll be uploading a new blogpost showing a couple of ways to set up backup notification in 2012. For emailing from scheduled tasks you can use powershell Send-MailMessage and use the same WSB event triggers. That will require you to learn basic powershell scripting If you’re more comfortable with batch files you could use a command line mailer such as Blat.
Hi,
Here’s a little powershell script I’ve done for this purpose. It’ll send email with the eventlog details it can found on error or warning events. You can add “information” entry type as well if you want. Make sure you enter your email serveur to replace the $youremailserver string and a valid email adress to replace the string emailadress. This way you have to create only one scheduled task when there’s an event on backup source as trigger. :
$TimeGenerated = get-eventlog application -newest 1 -entrytype Error,Warning -source “Microsoft-Windows-Backup” | Format-List -property TimeGenerated | out-string
$Source = get-eventlog application -newest 1 -entrytype Error,Warning -source “Microsoft-Windows-Backup” | Format-List -property Source | out-string
$EntryType = get-eventlog application -newest 1 -entrytype Error,Warning -source “Microsoft-Windows-Backup” | Format-List -property EntryType | out-string
$Message = get-eventlog application -newest 1 -entrytype Error,Warning -source “Microsoft-Windows-Backup” | Format-List -property Message | out-string
$Body =”
$TimeGenerated
$Source
$EntryType
$Message”
Send-MailMessage -to emailadress -subject ‘Whatever you want as subject’ -Body $Body -BodyAsHtml -smtpserver $youremailserver -from Microsoft-Windows-Backup@servername.com -priority High
Thanks for the walkthrough. Is there any way to configure the task email settings to input ssl or other auth methods if the host does not have exchange?
thanks
Hi Tim. The Task Scheduler send email method is inherently limited and is actually being discontinued, so this isn’t a feature that’s available. The easiest workaround is to use a command line mailer such as blat or set up a mail relay such as an IIS Mail Server or a Dyn.com smtp relay service, for example.
Cheers,
Alex
Thanks a lot!
Perhaps 18,19,20,21 ids events are missing in your list.
This list is inclusive: 5,8,9,17,18,19,20,21,22,49,50,52,100,517,518,521,527,528,544,545,546,561,564,612.
This is the reference:
http://technet.microsoft.com/en-us/library/cc734488%28v=ws.10%29.aspx
errata corrige:
the task scheduler doesn’t accept the 18 id event, probably because it refer to itself.
Any clarification will be apreciated.
Hi Collapsealone, in your situation you can manually edit the XML event filter created in task scheduler. I think that the OS behaviour in triggered tasks has changed since I wrote this post…
Hi All,
It allow only digits in events trigger…
Hoc can I edit XML file ??
*[System[Provider[@Name=’Microsoft-Windows-Backup’] and EventID=5891722495052100517518521527528544545546561564612]]
Thank for any help !!
I get an error when trying to run the PowerShell scripts
see:
PS C:\Users\Westcoastadmin> $TimeGenerated = get-eventlog application -newest 1 -entrytype Error,Warning -source “Micros
oft-Windows-Backup” | Format-List -property TimeGenerated | out-string
PS C:\Users\Westcoastadmin> $Source = get-eventlog application -newest 1 -entrytype Error,Warning -source “Microsoft-Win
dows-Backup” | Format-List -property Source | out-string
PS C:\Users\Westcoastadmin> $EntryType = get-eventlog application -newest 1 -entrytype Error,Warning -source “Microsoft-
Windows-Backup” | Format-List -property EntryType | out-string
PS C:\Users\Westcoastadmin> $Message = get-eventlog application -newest 1 -entrytype Error,Warning -source “Microsoft-Wi
ndows-Backup” | Format-List -property Message | out-string
PS C:\Users\Westcoastadmin> $Body =”
>> $TimeGenerated
>> $Source
>> $EntryType
>> $Message”
>> Send-MailMessage -to pbissada@westcoastplasticrecycling.com -subject ‘Backup Status’ -Body $Body -BodyAsHtml -smtpser
ver shawmail.vc.shawcable.net
>> -From Microsoft-Windows-Backup@wcprmail.com -priority High
>>
cmdlet Send-MailMessage at command pipeline position 1
Supply values for the following parameters:
From:
You’ve not supplied a “From” address, as per the text of the error message. Emails are required to have a populated “From” field.
Perhaps it’s because you used a capital “F” instead of a lowercase one?
PS C:\Users\Westcoastadmin> $TimeGenerated = get-eventlog application -newest 1 -entrytype Error,Warning -source “Micros
oft-Windows-Backup” | Format-List -property TimeGenerated | out-string
PS C:\Users\Westcoastadmin> $Source = get-eventlog application -newest 1 -entrytype Error,Warning -source “Microsoft-Win
dows-Backup” | Format-List -property Source | out-string
PS C:\Users\Westcoastadmin> $EntryType = get-eventlog application -newest 1 -entrytype Error,Warning -source “Microsoft-
Windows-Backup” | Format-List -property EntryType | out-string
PS C:\Users\Westcoastadmin> $Message = get-eventlog application -newest 1 -entrytype Error,Warning -source “Microsoft-Wi
ndows-Backup” | Format-List -property Message | out-string
PS C:\Users\Westcoastadmin> $Body =”
>> $TimeGenerated
>> $Source
>> $EntryType
>> $Message”
>> Send-MailMessage -to pbissada@westcoastplasticrecycling.com -subject ‘Backup Status’ -Body $Body -BodyAsHtml -smtpser
ver shawmail.vc.shawcable.net
>> -From Microsoft-Windows-Backup@wcprmail.com -priority High
>>
cmdlet Send-MailMessage at command pipeline position 1
Supply values for the following parameters:
From:
A way better way of doing this is using PowerShell. You can get a nicely formatted mail-report using this script:
http://blog.jocha.se/tech/wbadmin-backup-mail-report
Does this still work for hosted email service (e.g. Cbeyond or GoDaddy hosts my Exchange, but we have data on a local server that needs to be backed up)?
The scheduled task send email method doesn’t allow for authentication, so this won’t work with a hosted mail system. You need an on-premises SMTP relay.
We have an article covering this 🙂
https://www.bluecompute.co.uk/blogposts/creating-email-smtp-relay-server-windows-2008-2012/
I made this work with Office365, but only to other folks in the same domain.
The server has to be the same as your MX record; example “xxxxx-com.mail.protection.outlook.com”
Use port 25.
You *might* need to add an SPF record too. See here https://technet.microsoft.com/en-us/library/dn554323.aspx#configconnector
If you want to send to any domain, you’ll need to combine these instructions with the ones on setting up an SMTP Relay here:
https://www.bluecompute.co.uk/blogposts/creating-email-smtp-relay-server-windows-2008-2012/
There is a way of extracting the Event ID from a scheduled task triggered by an event and then passing it to a PowerShell script. See https://blogs.technet.microsoft.com/wincat/2011/08/25/trigger-a-powershell-script-from-a-windows-event/
PowerShell script and HowTo at http://www.wiseoldcat.com/?q=node/29