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: Eject Tape after successful Backup with SBS Backup

  1. Implement "How to add an email in Health Monitor" as described on the first page.
  2. You will first have to find out how the tape drive is named. From Server Management, Advanced Management, Computer Management, Storage, Removable Storage, Libraries: 

     

  3. Open "Health Monitor" and expand servername. Right click "Actions", "New", “Command Line Action".



  4. Tab "Details" insert the following:
    File name: C:\WINDOWS\system32\rsm.exe
    Working directory: C:\WINDOWS\system32
    Command line: eject /LF"<NameofBackupDevice>" /astart

     

    Set the Process Timeout to 20 Minutes, which should be enough for even the slowest device to eject the Tape.
  5. With this information you can finish the Health Monitor Action by clicking "Ok".
  6. This new action then can be added in Health Monitor to the "Windows Small Business Server Backup succeeded” event in tab Actions. Click on the “New Action Association” and change the “Execution condition” from Critical to OK:

     

Now the Tape will be ejected after a successful backup and can be a good indicator to the person who's responsible for changing the tape, if the backup was successful or not.

This method is proved with third-party Backup software like Symantec Veritas backup Exec.

Also that person does not have to wait anymore for the device to eject the tape. And with this method a tape that contains a successful backup set will not be overwritten with the next scheduled backup, which might be unsuccessful, only because someone forgot to change the tape.

German version by Oliver Sommer: http://dnn.mssbsfaq.de/SBS2003/HealthMonitor/HOWTOBandnacherfolgreicherSicherungauswerfen/tabid/411/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