Home / Guides / Windows Server Backup email alerts

Windows Server Backup email alerts with a scheduled task

Windows Server Backup sends no email of its own. This guide shows how to make one: a scheduled task that fires when a backup finishes or fails, writes the result into a short mail, and sends it to a monitoring address that alerts you on failure and on silence.

Short answer.

Create a Task Scheduler task triggered by the backup events in the Microsoft-Windows-Backup/Operational log (finished: 4 and 14; failed: 5 and 517). Have it run a short PowerShell script that reads the newest such event and mails one line per field to your monitoring address, with your own mail relay. Then watch for failures and for the nights no mail arrives.

Step 1: find the events on your server

Run a backup once and open Event Viewer, Applications and Services Logs, Microsoft, Windows, Backup, Operational. BackupBeat reads events 4 and 14 as a finished backup and 5 and 517 as a failed one. Microsoft's support articles show event 517 and event 521 (a volume shadow copy failure) with the source Microsoft-Windows-Backup, listed under the Application log; the Operational log above is the one BackupBeat's setup uses. Microsoft does not publish a current event list for newer server versions, so confirm the IDs and the log against a real run on your server before you rely on them.

Step 2: the script

In PowerShell the log is addressed as Microsoft-Windows-Backup (Event Viewer shows it as Operational under Backup). The Log: line in the mail is only a label for BackupBeat's reader.

The script builds the subject and the body. Sending is left to you because Microsoft marks Send-MailMessage as obsolete (it does not guarantee a secure connection to the SMTP server) and recommends a library such as MailKit, or Send-MgUserMail if you use Exchange Online. Use your own relay, and do not put a password in the script text.

# Build the result mail for the newest Windows Server Backup result event.
$ev = Get-WinEvent -FilterHashtable @{ LogName = 'Microsoft-Windows-Backup'; Id = 4,5,14,517 } -MaxEvents 1
$computer = $env:COMPUTERNAME
$subject = "[$computer] Windows Server Backup: Event $($ev.Id)"
$body = @(
  "Windows Server Backup report (scheduled task)"
  "Computer: $computer"
  "Log: Microsoft-Windows-Backup/Operational"
  "EventID: $($ev.Id)"
  "TimeCreated: $($ev.TimeCreated.ToString('yyyy-MM-dd HH:mm:ss'))"
  "Message: $(($ev.Message -split "`r?`n")[0])"
) -join "`r`n"

# Send $subject and $body to your BackupBeat address with your own mail relay here.

Save it, for example, as C:\Scripts\Send-BackupResult.ps1 and add your send call where the comment says.

Step 3: the scheduled task

  1. Open Task Scheduler and choose Create Task. Pick an account that can read the event log, and tick Run whether user is logged on or not.
  2. On Triggers add On an event. The Basic setting takes a single event ID, so choose Custom and New Event Filter, pick the Backup log, and list the IDs 4,5,14,517; or add one trigger per ID. (If your server logs 517 in the Application log, as Microsoft's articles show, add that log to the filter.) This dialog was not tested on a live server, so check that a real backup fires the task.
  3. On Actions run powershell.exe with -NoProfile -ExecutionPolicy Bypass -File C:\Scripts\Send-BackupResult.ps1.
  4. Run a real backup, and check that one mail arrives with the lines shown above.

What the mail must look like for BackupBeat

BackupBeat has a reader for this layout: one line per field (Computer, Log, EventID, TimeCreated, Message), and a subject of the form [computername] Windows Server Backup: Event 4. It treats events 4 and 14 as finished (a message that mentions errors or warnings is downgraded to a warning) and 5, 517, 518, 521, 546 and 561 as failed. It needs the product name or the log name in the mail, which the script above provides. A "started" event alone gives no result, so keep it out of the trigger. Note that this layout is BackupBeat's own wrapper, and the script has not been run against a live backup server.

Add the schedule, so silence is an alert too

A server that is off, a task that was deleted, or a mail relay that broke sends nothing. In BackupBeat, set the job's schedule (for example daily around 03:30 with a 2-hour grace time): if the mail is not there by then, the job is marked Missed and you are alerted. See how to catch a missed backup.

Questions

Does Windows Server Backup send email?

No. It writes events to its Operational event log. To get mail you need something that reads those events and sends a message, such as a Task Scheduler task with an On an event trigger.

Which events show that a Windows Server Backup run finished or failed?

Events 4 and 14 are read as finished and 5 and 517 as failed (517 and 521 are shown in Microsoft's support articles with the source Microsoft-Windows-Backup). Confirm the IDs on your own server, because Microsoft does not publish a current list for newer versions.

Why does the guide not use Send-MailMessage?

Microsoft marks Send-MailMessage as obsolete because it does not guarantee a secure connection to the SMTP server. Use your own relay with a library such as MailKit, or Send-MgUserMail with Exchange Online.

How do I know the backup did not run at all?

A task that never ran creates no event and so no mail. Give the job a schedule and a grace time in your monitor, so that a mail that does not arrive is raised as Missed.

Related

Sources (read December 4, 2026): Microsoft Learn, System state backup by using Windows Server Backup fails: event 517, Windows Server backup may fail because of the SQL Server VSS writer: event 521 and Send-MailMessage (obsolete notice).

An unhandled error has occurred. 🗙