Solved

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

Posted on 2014-01-29
19
6,226 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
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

In my previous Experts Exchange Articles (http://www.experts-exchange.com/ARTH_1864316.html?arthOrderBy=3&arthSort=1#arth), most have featured Basic and Intermediate VMware Topics.  As a Virtualisation Consultant, we implement many different virtual…
Every now and then, Microsoft does something that totally impresses me. It doesn't happen often, but in this case I must say I am thoroughly impressed with Windows Server Backup. One of the long time issues with Windows Backup has been the ability t…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

785 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