Automated Robocopy Backups With Email Notification

What happens is you schedule a task to run the first Robocopy script. Based on the error level output one of two things happen: a success or failure. If there is success you run one batch file, if it fails you run another.

The other week I was horsing around and came up with this method of backing up some files on Windows using Robocopy, and automatically sending an email of the results based on success or failure using Robocopy’s error level output codes.

There’s basically 3 parts that make this thing work:

  1. The Robocopy script or scripts
  2. Fail or Success send email script
  3. Powershell scripts to send the email based on success or failure

What happens is you schedule a task to run the first Robocopy script. Based on the error level output one of two things happen: a success or failure. If there is success you run one batch file, if it fails you run another.

That second batch file runs a PowerShell script that sends an email (saying success or fail in the subject) and attaches the Robocopy log.

Let’s dive in 🙂

Continue reading “Automated Robocopy Backups With Email Notification”