Solved

E-Mail alerts for Windows Server Backup 2012 based on eventID trigger

Posted on 2014-01-29
19
5,963 Views
Last Modified: 2014-01-31
Can someone please help me with a method of sending E-Mail alerts for the Windows Server 2012 backup utility based on eventID for successful and failed backups?
0
Comment
Question by:BobTheITGuy
  • 10
  • 9
19 Comments
 
LVL 13

Expert Comment

by:Felix Leven
Comment Utility
The link shows a good colleciton of all the eventid's showing that something is wrong with your backup and how to set the Trigger in the eventlog.

http://crashmag.net/windows-server-backup-notifications

Using a Little powershell script can be more dynamic:
http://focusedit.co.uk/blog/76-windows-server-backup-send-email-when-complete
0
 

Author Comment

by:BobTheITGuy
Comment Utility
Yes, I understand the process in the link attached but it does not apply to Windows Server 2012 standard as the feature had been discontinued.  Are there any other options available?
0
 
LVL 13

Expert Comment

by:Felix Leven
Comment Utility
In Server 2012 Server Manager Dashboard go to "Add roles and features" and then in the wizard select the option "Windows Server Backup" under features.

It is different, it does not like backup to tape, but it's there.
0
 

Author Comment

by:BobTheITGuy
Comment Utility
Yes, I have the Windows Backup installed and functional.  But when I try to configure an E-mail alert from a task, the system returns the message:

"An error has occurred for task
 Microsoft-Windows-Backup_Microsoft-Windows-Backup_4.  Error message: The following error was reported: The task definition uses a deprecated feature.
0
 
LVL 13

Expert Comment

by:Felix Leven
Comment Utility
Yes, second link pls. I was not sure about it.

Sending email ist not possible anymore (never used it myself), but starting a powershell script and sending mail from the script works.
0
 

Author Comment

by:BobTheITGuy
Comment Utility
Just attempted the powershell function and within the EventViewer task results, the task did not send an E-mail and returned the "last run result" of "Incorrect function. (0x80070001).  Can you offer any help?
0
 
LVL 13

Expert Comment

by:Felix Leven
Comment Utility
The account must have the
Logon as a batch job\Log on as a service permission on the local machine.

What user do you use to execute the trigger in taskplaner ?
0
 

Author Comment

by:BobTheITGuy
Comment Utility
For now the domain admin account so as to minimize the risk of permissions issues.
0
 
LVL 13

Expert Comment

by:Felix Leven
Comment Utility
I have tested it myself and it is working.

Is "Set-ExecutionPolicy RemoteSigned" set in powershell ?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:BobTheITGuy
Comment Utility
I think I have it set for the script but when I execute, this is the first section of output:

add-pssnapin : No snap-ins have been registered for Windows PowerShell version 3.
At C:\BackupEmail\EmailBackupResults.ps1:10 char:1
+ add-pssnapin windows.serverbackup
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (windows.serverbackup:String) [Add-PSSnapin], PSArgumentException
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
0
 
LVL 13

Expert Comment

by:Felix Leven
Comment Utility
Change:
add-pssnapin windows.serverbackup

to
Import-Module WindowsServerBackup
0
 

Author Comment

by:BobTheITGuy
Comment Utility
A different error message appeared this time (below), I'm not familiar with PowerShell yet at all but is there some config/setup required?

Import-Module : The specified module 'WindowsServerBackup' was not loaded because no valid module file was found in any
module directory.
At C:\BackupEmail\EmailBackupResults.ps1:10 char:1
+ Import-Module WindowsServerBackup
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (WindowsServerBackup:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
0
 
LVL 13

Expert Comment

by:Felix Leven
Comment Utility
ok, sorry for the confusion Import only works in 2012 R2 Server.


Add-Pssnapin windows.serverbackup -> should load all the commands to work with Windows backup and is used in the powershell sctipt.

But, they are missing and can't be added by the command Add-Pssnapin windows.serverbackup.

Solution:
In the Add Features Wizard, on the Select Features page, expand Windows Server Backup Features, and then select the check boxes for Windows Server Backup and Command-line Tools.
0
 

Author Comment

by:BobTheITGuy
Comment Utility
On my server, I don't have any option to expand the "Windows Server Backup".  Could it be located somewhere else?
0
 
LVL 13

Expert Comment

by:Felix Leven
Comment Utility
Just delete the line add-pssnapin, powershell will load what it needs on 2012 server.
0
 

Author Comment

by:BobTheITGuy
Comment Utility
No success with this option either.  I think I'll move to another option until I become a little more experienced with PowerShell.
0
 
LVL 13

Expert Comment

by:Felix Leven
Comment Utility
one more try please. For now we keep it simple:
# Set up variables
$SmtpServer = "192.168.1.1"
$SmtpPort = 25
$FromEmail = "admin-email-address"
$ToEmail = "recipient-email-address"

# Construct and send email
$SmtpClient = new-object system.net.mail.smtpClient
$Msg = new-object Net.Mail.MailMessage
$SmtpClient.host = $SmtpServer
$SmtpClient.Port = $SmtpPort
$computer = gc env:computername
$Msg.From = $FromEmail
$Msg.To.Add($ToEmail)
$Msg.Subject = "## Backup Complete on " +$Computer +" ##"
$Msg.Body = "The backup for " +$Computer+" has completed. Please see the attached file for backup results."
$SmtpClient.Send($Msg)

Open in new window

0
 

Author Comment

by:BobTheITGuy
Comment Utility
Huge step forward.  Mail is being sent now but no attachment.  Is there something further I need to configure?
0
 
LVL 13

Accepted Solution

by:
Felix Leven earned 400 total points
Comment Utility
I skiped the attachment, because this is the part  thats not working on your server. You must find out why the backup powershell commands are missing on your server.

To continue, just make a script for every success and failedl eventid (first link) you are interested in and change the subject of the mail send. If a mail arrives you can go and check the backup logs.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

Recently, I was assigned the task of performing a hardware refresh in the datacenter. The previous Windows 2008 systems were connected to the SAN via fiber channel HBA’s and among other thing, had PowerPath installed in order to provide sufficient f…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now