Windows Server Backup 2008 email notifications

To setup Windows Server Backup 2008 email notifications and use an authenticated SMTP relay you need to script it and setup a scheduled task to run your script. Of course if you have an Exchange Server in your organisation you can use scheduled tasks to do an anonymous relay based on an event ID.

First example is for unencrypted username and password, for this you will need the sendemail application available from here. There are other’s you can use but if you plan to relay via gmail as in the example you need one that supports TLS.

Save the following as backup.bat

powershell set-executionpolicy unrestricted
powershell -file C:\BackupReport\backup.ps1 powershell set-executionpolicy default
C:\BackupReport\SendEmail\sendemail.exe -f -t -u Daily Backup Report -m Open Attachment for Report -s -a C:\BackupReport\backupserver.txt -xu username -xp password -o TLS=Yes

Save the following as backup.ps1

$yesterday = (Get-Date) - (New-TimeSpan -day 1)
Get-WinEvent -logname "Microsoft-Windows-Backup" |
where {$_.timecreated -ge $yesterday} |
Format-Table TimeCreated, ID, ProviderName, Message -AutoSize -Wrap > C:\BackupReport\backupserver.txt

Save these to an appropriate location on the server being backed up and set a scheduled task to run the backup.bat file on whatever schedule you require.

Encrypted credentials version coming soon….


Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>