The Historical Post Series are writings I produced in my former blog on Live Spaces and due their value are being reposted here. Hope you enjoy these.
auto-eject script and email alert for SBS tape backup
originally posted October 2006
I created a folder C:batch then inside it a 5633.vbs file with the following contents:
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 = "email@example.com"
objMessage.To = "firstname.lastname@example.org"
objMessage.Cc = "email@example.com"
objMessage.TextBody = "SBS Backup Succeeded"
This VBS script uses both the RSM command which you can explore for more information on the switch options. Initially I tried using various switches and ended up having to learn how to identify and then use the GUID of the Library used. The GUID in red is unique to this library and you would of course have to modify this to suit your specific situation whether a library, drive, …etc.
The next step uses this script using the "eventtriggers" command. Under the context of what I’ve created above you would then on one line at a command prompt enter the following exactly:
eventtriggers /create /tr SBSBackupSuccess /eid 5633 /t INFORMATION /tk "c:batch5633.vbs" /ru "System"
Event 5633 is for a successful backup and complements event 5634 for a failed backup. SBS has a built in alert for event 5634 but no provision for a successful backup.
Go into the Health and Monitoring Console and see how this has been added and how this now works. It will intuitively explain a lot of what the SBS alert wizard sets up and how to go outside that box.
**Credit and much thanks given to Bob Haley and Marina Roos for their large contributions.**