Icon explained    
Articles marked with this logo are 'subscriber' only articles. Click here to become a subscriber
Small Business Server articles and howto's    

Current Articles | Search

Add an email alert after successful backup
By Marina Roos :: 12 Comments :: :: SBS 2003, Backup and restore, Public articles
TERMS
This document and what comes with it are provided as-is with blunt warning: Use at your own risk, buyer beware. You break your system; you own the resolution as well. We have no liability for what you do, or can't do, or fail to do with this information. Your entire protection is to start over again with a protected backup, or from protected system. If you don't want to accept this idea, please don't use this document.
HOW TO: add an email alert after successful backup
 
Co author is Oliver Sommer (http://mssbsfaq.de)
The purpose of this article is to explain step-by-step how to add an email alert in Health Monitor. In this article we will add an alert that will send an email when the backup has been successful.
  1. Start, All Programs, Administrative Tools, Health Monitor.
  2. Expand the servername and Small Business Server Alerts, Core Server Alerts. 
    Here are all events listed that will throw an alert through email and/or Performance Reports.
  3. We will copy the “Windows Small Business Server Backup failed (Event ID: 5634)" and paste it, after which we will modify this alert so it will send an email when the backup has succeeded.
    Right click the “Windows Small Business Server Backup failed” event and select Copy:

     

  4. Right click “Core Server Alerts” and select Paste:

     

  5. Right click the pasted event (sometimes you will need to Refresh the view to see the pasted new event) and select Rename and change it to “Windows Small Business Server Backup succeeded (Event ID: 5633)”. Right click the event and select Properties: 

     

  6. Perform the following changes to the new Event. The Details tab should look like the following:

     

  7. On tab Actions we first will select the second action and delete it:

     

  8. Then we select the email action and select properties and change the Execution condition to Ok:



  9. In the tab Message the text should be changed to 'succeeded' in stead of failed:

     
 
When the SBS Backup has been successful, an email should be send with status "Ok".

Note: the only disadvantage is, that every time you open Health Monitor or you reboot the server, the successful alert will be send too. We have found no way of preventing this from happening, so if anyone has got a solution for this little annoyance, please let us know.

German version by Oliver Sommer: http://dnn.mssbsfaq.de/SBS2003/HealthMonitor/HOWTOEmailimSBSBackupErfolgsfall/tabid/410/Default.aspx


Previous Page | Next Page
Comments
By Dale Unroe @ Thursday, March 23, 2006 4:55 PM
Oliver, thank you so much for automating but one more aspect of daily routine. The only downside to this is that any tape will eject whenever the server has to restart; as infrequent as that may be it will be a tradeoff to remember to disable this action in the Health Monitor if I'm doing some kind of remote patching that requires a restart. Still I think this is a terific find. Thank you!

By Leon van Kesteren @ Wednesday, April 12, 2006 9:24 AM
For some reason i cannot select the option to send an email alert when I'm following your instructions regarding the email after successful backup.

Step 7 only shows me the options to store an alert in the monitoring database. Am i doing something wrong or did i forget an option?

By @ Friday, June 09, 2006 1:05 AM
"Note: the only disadvantage is, that every time you open Health Monitor or you reboot the server, the successful alert will be send too. We have found no way of preventing this from happening, so if anyone has got a solution for this little annoyance, please let us know."

Here is the solution: forget everything in this article except the EventID code is 5633! Use the (little known) eventtriggers command, and a small vbscript to send an email, and the job is done.

1. Create a folder (ie. c:\batch), then create a new empty text file in that folder, and rename it to 5633.vbs. Edit the file using Notepad to contain the following code:

'begin code
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "SBS Backup"
objMessage.From = "administrator@domain.com"
objMessage.To = "someaddress@domain.com"
objMessage.TextBody = "SBS Backup Succeeded"
objMessage.Send
'end code

Change the addresses in 5633.vbs to match your domain (leave the administrator but change the domain name in the objMessage.From), and the real address where you want the email to be sent (objMessage.To). Then double click the file to run this little script, and you should get an email, just to test it.

2. Enter this line at a command prompt (you may see this as multiple lines in this posting, but it must be entered as a single line at the command prompt):

eventtriggers /create /tr SBSBackupSuccess /eid 5633 /t INFORMATION /tk "c:\batch\5633.vbs" /ru "System"

Make sure that the path to 5633.vbs matches the path that you enter in the command prompt.

3. Don't blame me if you get addicted to vb script and eventtriggers.


By Marina Roos @ Friday, June 09, 2006 1:38 AM
Hi Bob,

Oh, this is a beauty indeed! Thanks so much. Never knew about that eventtriggers and I noticed a vbs script that was included as well for querying eventlogs.
Mariette is much more into scripts than me, but this might get me hooked too ;-)
Have you got other beauties?

By Andrew Hussey @ Friday, June 09, 2006 12:42 PM
That looks usefull.

I'm just trying this and I have one immediate question.

How do you go about specifying multiple 'to' email addresses?

We'd like the same messages to come to us and our client's designated tape changer.

Thanks in advance.

Andrew

By Andrew Hussey @ Friday, June 09, 2006 1:07 PM
Sorry. That was pure laziness posting that question. It took me longer to type the question than find the answer.

I found that, surprisingly enough, you can just add lines with "objMessage.Cc.........." and "objMessage.Bcc...." and seperate multiple addresses within the quotes with semicolons.

Andrew

By Dale Unroe @ Friday, June 09, 2006 1:22 PM
can you vbscipt the tape eject?

that is the painful point not an extra email (though the event triggered vbscripted email is pure gold)

By @ Friday, June 09, 2006 2:23 PM
Dale
Using the command line in the article as a starting point, I would add these four lines to the beginning of 5633.vbs

On Error Resume Next
Set objShell = WScript.CreateObject("WScript.Shell")
strCommand = "rsm eject /LF""Sony AIT 50 GB SCSI Drive"" /astart"
Set objWshScriptExec = objShell.Exec(strCommand)

Notice that quotes that appear in a command line need to be doubled inside the strCommand string, and that entire string is enclosed in quotes. You can execute almost any command line in this same way.

(sorry I can't test this as all of my clients use removable IDE drives for backup)

You can test the script by double clicking the file to run it, and if your tape ejects and sends you an email, then you can get yourself a well-deserved cup of cafe mocha.

By Dale Unroe @ Friday, June 09, 2006 3:34 PM
'begin code
On Error Resume Next
Set objShell = WScript.CreateObject("WScript.Shell")
strCommand = "rsm eject /LF"SEAGATE AIT SCSI Sequential Device" /astart"
Set objWshScriptExec = objShell.Exec(strCommand)
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "SBS Backup - Completed Successfully"
objMessage.From = "administrator@yourdomain.com"
objMessage.To = "someone@somedomain.com"
objMessage.Cc = "someoneelse@somedomain2.net"
objMessage.TextBody = "SBS Backup Succeeded"
objMessage.Send
'end code

so something along these lines? - notice I modified the tape device as needed

By @ Friday, June 09, 2006 4:59 PM
I believe you will need to double the quotes inside the strCommand.

strCommand = "rsm eject /LF""SEAGATE AIT SCSI Sequential Device"" /astart"

you can always add a Wscript.echo after that line AS A TEST ONLY to see what string you are passing to the command shell. You will have to remove it in the final script because it requires user interaction to continue.

strCommand = "rsm eject /LF""SEAGATE AIT SCSI Sequential Device"" /astart"
Wscript.echo strCommand

By Dale Unroe @ Monday, September 11, 2006 9:35 PM
Sorry, I had intended to write this follow up a long time ago to provide the comlete solution. The double quotes didn't work within the VBS code and I couldn't find the proper way to code through the issue. To work around this I discoverd a different method with the RSM Eject command that uses an ID (the GUID) that doesn't require any spaces and therefore no quotations.

Below is the functioning code that I am now using:

'begin code
On Error Resume Next
Set objShell = WScript.CreateObject("WScript.Shell")
strCommand = "rsm eject /LGA2A90879A1994371BDE6D8713FF2061C /astart"
Set objWshScriptExec = objShell.Exec(strCommand)
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "SBS Backup - Completed Successfully"
objMessage.From = "administrator@xxxx.com"
objMessage.To = "xxxx@xxxx.com"
objMessage.Cc = "xxxx@xxxx.net"
objMessage.TextBody = "SBS Backup Succeeded"
objMessage.Send
'end code

To learn more about the RSM Eject command syntax as well as how to obtain the GUID you need for your particular server, type RSM EJECT /? in a command window.

By Nicolas Rabaté @ Thursday, December 27, 2007 3:34 PM
So I got a cup of mocha! Thank you for this wonderfull trick

You must be logged in to post a comment. You can login here