If you scheduled a Windows Server Backup, you can check for Errors and send an email if a Error happened.
To do this just schedule to run the following script after your backup job:
# Check EventLog for Error created by Windows Backup
If (Get-EventLog -LogName Application -EntryType Error -Source Microsoft-Windows-Backup -After (Get-Date).AddHours(-24))
{
#Set E-mail variables.
$EmailFrom = "server@yourdomain.com"
$EmailTo = "Tim.Buntrock@yourdomain.com"
$Subject = "$env:COMPUTERNAME - Windows Backup failed"
$Body = "$env:COMPUTERNAME - Windows Backup failed. Please logon to the server and verify your backup task!"
$SMTPServer = "smtp01.yourdomain.com"
#Send message
Send-MailMessage -Subject $Subject -Body $Body -SmtpServer $SMTPServer -Priority High -To $EmailTo -From $EmailFrom
}
Else
{
exit
}
Thats it. :)
No comments:
Post a Comment