Menu Close

Tag: scripts

Configure Email Notification for Windows Server Backup

Windows 2008 (R2) and 2012 (R2) all include the Windows Server Backup feature, which is a reliable but basic backup utility. I only use Windows Server Backup when the server is a physical server. The Windows Server Backup allowing you to restore data or the entire server as necessary. The only downside in WSB is the lack of a reporting function.

Because it is very important to see the status of a back-up job,so that any failures are addressed immediately. WSB doesn’t natively allow you to configure notification emails that advise on the success or failure of each backup.

WBS_Eventviewer
Windows Eventviewer – Backup failure and success events

Windows Server Backup writes operational events to its own event log, located at Logs > Applications and Services Logs > Microsoft > Windows > Backup > Operational. Successful or unsuccessful completion of the backup is logged at this location, so we can use these events as a trigger to send ‘success’ or ‘failure’ email to a particular backup admin user.

WBS_Task_scheduler
Windows Task Scheduler – Backup tasks

Create success email task

The goal is to trigger the notification on backup completion. Because it is more practical to set up two notification (failure of success) we need two tasks.

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
  • Go to the trigger tab, press “New”, choose “On an event”, select “Custom” and then “New Event Filter”
  • Select “By log”, then navigate to “Applications and services logs”, then “Microsoft, then “Windows” then find “Backup” and tick it
  • Use the following Event ID’s
4
  • Save your changes and navigate to the actions tab of the task
  • Action: Send an email (configure email settings, subject, body etc as required)

Create failure email task

After you configured the correct settings you can save this task and create another one to be triggered on backup failure. This one has more event triggers, because there are multiple backup failure event codes. Configure the task as follows:

  • Name: Backup Failure Email Task
  • Description: Notifies backup admin of scheduled backup failure
  • Run whether user is logged in or not
  • Go to the trigger tab, press “New”, choose “On an event”, select “Custom” and then “New Event Filter”
  • Select “By log”, then navigate to “Applications and services logs”, then “Microsoft, then “Windows” then find “Backup” and tick it
  • Use the following Event ID’s
5,8,9,17-22,49,50,52,100,517,518,521,527,528,544,545,546,561,564,612
  • Save your changes and navigate to the actions tab of the task
  • Action: Send an email (configure email settings, subject, body etc as required

If you want to test your email notifications, be sure to check the “Allow task to be run on demand” option under the Settings tab.