Solved

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

Posted on 2014-01-29
19
6,586 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
19 Comments
 
LVL 13

Expert Comment

by:Felix Leven
ID: 39818024
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
ID: 39818042
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
ID: 39818083
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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 

Author Comment

by:BobTheITGuy
ID: 39818137
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
ID: 39818169
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
ID: 39818523
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
ID: 39818953
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
ID: 39819324
For now the domain admin account so as to minimize the risk of permissions issues.
0
 
LVL 13

Expert Comment

by:Felix Leven
ID: 39820225
I have tested it myself and it is working.

Is "Set-ExecutionPolicy RemoteSigned" set in powershell ?
0
 

Author Comment

by:BobTheITGuy
ID: 39821057
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
ID: 39821067
Change:
add-pssnapin windows.serverbackup

to
Import-Module WindowsServerBackup
0
 

Author Comment

by:BobTheITGuy
ID: 39821345
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
ID: 39821405
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
ID: 39821641
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
ID: 39821769
Just delete the line add-pssnapin, powershell will load what it needs on 2012 server.
0
 

Author Comment

by:BobTheITGuy
ID: 39822143
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
ID: 39824329
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
ID: 39824812
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
ID: 39824926
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My GPO's made for 2008 R2 servers were not allowing me to RDP into a new 2012 server by default.  That’s why I tried to allow RDP via Powershell, because I could log into a remote shell without further configuration. Below I will describe how I wen…
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
In this Micro Tutorial viewers will learn how to restore their server from Bare Metal Backup image created with Windows Server Backup feature. As an example Windows 2012R2 is used.
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

751 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