Windows Computer or Server all includes the Windows default Backup feature, which is a reliable. You can easily recover whole computer/Server in case it crashes or recover files if deleted or missing but doesn’t have ability to send any kind of notification. Now think about having more than one computer or server its hard to login to each one of those and see if they are successful or not, moreover you won’t even come to notice if the disk space of target drive is getting filled.
Default Windows backup do not have notification feature that allows you to monitor the status of the backup job you have scheduled. Now how about getting full html email report of the backup status? see the screenshots below as you see we can have full email report of backup status plus at what time it started, when it completed, it was successful or not, storage capacity of the target drive, how much space if left free, what are the components and volumes its currently backing up and what type of backup is set.
Now look at screenshot 2 at the failed backup report you can clearly see the event and reason for its failure you can research on it and fix it and run again backup again.
Screenshot 3 warns you in future backups are going to be failed because the target disk is getting filled.
Backup success Report [screenshot 1]
Backup Failed Report [Screenshot 2]
Backup Warning alert [Screenshot 3]
Having said so, lets get started setting up email alert notifications for Windows backup.
1> Powershell V2 or above [above 2 for best result]
2> Administrative rights.
3> Command line tools installed along with Windows backup feature.
icon-arrow-circle-o-right Download the Powershell script from here [
By Downloading you agree that Allenage is not responsible for any kind of damage on your Server, application or network while this script is used. This script has been tested and runs on several servers we are hosting without any issues,Please read the entire script properly and take your best decision.]
And then open the script with notepad or Powershell editor look at the 3rd line, replace with customer name or your company name.
#Specify here the name of your customer
$Customer = "My Customer"
$Hostname = $env:COMPUTERNAME
Now jump to line 261 change the fields as it fits you add SMTP server, SMTP port no, username from whom email will be sent and password.
Under email recipient add the email address who will receive the Windows email alert , email from will be the same user who has been at as email SMTP user.
Look at line 278 $SMTPClient.EnableSsl = if your SMTP client has valid ssl set as $True if not $False otherwise you have not receive email.
# Send Email
$bodycont = (Get-Content $OutputFile)
# smtp server
$emailSmtpServer = "Smtp Server"
$emailSmtpServerPort = "port"
$emailSmtpUser = "firstname.lastname@example.org"
$emailSmtpPass = "password"
$emailFrom = "email@example.com"
$emailTo = "firstname.lastname@example.org"
$emailMessage = New-Object System.Net.Mail.MailMessage( $emailFrom , $emailTo )
$emailMessage.Subject = "##" + " - " + $Customer + " - " + "Backup report from: " + $Hostname + " ##"
$emailMessage.IsBodyHtml = $true
$emailMessage.Body = $bodycont
$SMTPClient = New-Object System.Net.Mail.SmtpClient( $emailSmtpServer , $emailSmtpServerPort )
$SMTPClient.EnableSsl = $False #if SSL is enable set as True
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential( $emailSmtpUser , $emailSmtpPass );
$SMTPClient.Send( $emailMessage )
But if you have setup your SMTP server to send anonymous email you can remove all those lines and head on to last line of the scripts 285 and add your own SMTP server address or ip, senders and receiver's email.
##### if added SMTP replay remove all # below the line ####
# $bodycont = (Get-Content $OutputFile)
# $smtp = "Exchange-Server"
# $to = "receiptiant email>"
#$from = "Sender mail"
#$subject = "Windows Backup For $Customer Reporting Server $Hostname"
#$body = "$bodycont"
#### Now send the email using \> Send-MailMessage
# send-MailMessage -SmtpServer $smtp -To $to -From $from -Subject $subject -Body $body -BodyAsHtml
And now after you have finished setting it up save and copy it to C drive or any other folder inside it.
Tip for users with Multiple Servers shared the folder and map it on action path so that you can easily deploy it just by exporting the Task Scheduler and import to another.
1> Setting it up: Open Task Scheduler create a new task call it Windows backup reports. Make sure you have selected run whether user is logged on or not run with highest privileges.
2> Creating Trigger: On Trigger tab select New, begin the task >select on an event and then select Custom > new event filter > select all the event level > select by log> and Microsoft-windows-backup/operational or you can select Sources select > backup and paste all the event ID's related to windows backup, note here event id 4 is for backup that are successful all others are for failed backups or minor warnings so that we won't miss any click on OK and come to actions tab.
3> Creating Action: Create new action set to start a program on program/script input box type Powershell.exe Arguments add this line -ExecutionPolicy Bypass -File "C:\alert.ps1" note: C:\alert is the path where the script resides it can be any depending on where you have placed it -Execution policy bypass is to bypass default Powershell restrictions that doesn't allow scripts to run which can be killed by hitting set-execution policy unrestricted any way no require for that as we are bypassing already. Click Ok and enter the password if it asks for and we are all set !
And from now you will be getting rich HTML email alert report for Windows backup. Please do leave us comments and feedback.
Best Works on Windows server 2012, Windows server 2012R2, Windows server 2008, Windows server 2008R2.