• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8173
  • Last Modified:

Windows Backup Email Notifications - Server 2012 R2 Standard

I have a server running Server 2012 R2 Standard.  I'm attempting to configure an email alert for when the backup completes or fails.  This used to work on Server 2012 (None R2) but for some reason it was removed in R2.  I was able to trigger an email based on a event log but can't complete this anymore.  I created a powershell script that isn't working as well as I believe it was designed for none R2.

This server is running Exchange 2013 and can relay off itself if needed.

Here is the script I've configured to run.

###############################################################
# Receive_Mail_Notification_If_Last_Windows_Server_Backup_Fails_v1.0.ps1
# input : n/a
# output : none (logs)
# Version 0.1
# Changelog : n/a
# MALEK Ahmed - 12 / 01 / 2013
###################

##################
#--------Main  
##################

$Sender = "Backup@domain.com"
$Receiver="personthatcheckstheback@domain.com"
$smtpServer = "Emailserver"

##################
#--------Main  
##################

$backup = Get-WBSummary
$backup.LastBackupResultHR
if ($backup.LastBackupResultHR -ne 1)
{
    #Mail Notification about errors
        $mailbody = "The Last Backup launched on " + (get-item env:computername).Value + " Completed Successfully.`r`n`r`n"
        $mailbody += $backup.DetailedMessage
        $msg = new-object Net.Mail.MailMessage
        $smtp = new-object Net.Mail.SmtpClient($smtpServer)
        $msg.From = $Sender
        $msg.To.Add($Receiver)
        $msg.Subject = "[SUCCESSFUL] The Last Backup launched on " + (get-item env:computername).Value + " Completed"
        $msg.Body = $mailbody
        $smtp.Send($msg)        
}
0
excaltech
Asked:
excaltech
1 Solution
 
Santosh GuptaCommented:
Hi,

not sure about power shell issue, but if you want you can use task scheduler to send the email notification.

sch
hope it will help you.
0

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now