We needed a way to automate backups on a machine. We knew that robocopy could accomplish the backup task, but we needed to find a way to automate it. In order to do this, we created a powershell script. In the code below, the top portion can be edited, however the bottom portion must stay the same.
Backup Script Below:

## What do you wish to copy?

## Where do you want to place the backup?

## Where do you want to save the log file?

## This file is used for the process of checking
## whether or not the backup was successful

## Change as necessary
$successEmailTo="Firstname Lastname "
$successEmailSubject="Subject Goes Here"
$successEmailBody="Body Goes Here"
$successEmailFrom="Firstname Lastname "

$failEmailTo="Firstname Lastname "
$failEmailSubject="Subject Goes Here"
$failEmailBody="Body Goes Here"
$failEmailFrom="Firstname Lastname "

## Depending on how many directories you are checking, you will need to change how many times this for loop will go
for ($i=0; $i -lt 1; $i++) {

## =========================================================
## ======== PLEASE DO NOT EDIT SCRIPT BELOW ================
## =========================================================

Write-Host $i

## robocopy will mirror a directory and log the file, note the log will append
robocopy $source[$i] $destination[$i] /mir /log+:$logDestination

## this will take a snapshot of the source and destination directory
$shot1 = Dir $source[$i]
$shot2 = Dir $destination[$i]

## This will compare the two snapshots and append it to a backup report
Compare-Object $shot1 $shot2 -PassThru > $backupReport

## send a success email
function sendSuccessEmail{
send-mailmessage -from $successEmailFrom -to $successEmailTo -subject $successEmailSubject -body $successEmailBody -Attachments "$logDestination" -priority High -dno onSuccess, onFailure -smtpServer $successEmailSMTPServer

## send a failure email
function sendFailEmail{
send-mailmessage -from $failEmailFrom -to $failEmailTo -subject $failEmailSubject -body $failEmailBody -Attachments "$logDestination" -priority High -dno onSuccess, onFailure -smtpServer $failEmailSMTPServer

## if the backup report has no feedback (all files were copied successfully) it will send a success email
$File = Get-ChildItem $backupReport
if ($File.Length -eq 0) {sendSuccessEmail}

## if the backup report has feedback (all files were NOT copied successfully) it will send a failure email
$File = Get-ChildItem $backupReport
if ($File.Length -gt 0) {sendFailEmail}

Finally, to make this script run every night at the same time. We used Windows' Task Scheduler. However task scheduler will not take .ps1 files (powershell files). So we needed to make a batch file that pointed to the powershell script.

Batch File Below:
powershell -command "& 'X:\RobocopyBackup.ps1' "

The above batch file was put into task scheduler and scheduled to run at a certain time everyday.