« Chapter 9 scripts | Main | Welcome, Andrey! »
August 15, 2005
UPDATED Aug 19 2005 - VBScript that will use NTBACKUP to back up Exchange 200x
Use NTBACKUP to back up your Exchange server to disk. The script works on single node servers and on clusters. It backs up all information stores and SRS if the latter is present. Backup logs are retrieved and e-mailed to a predefined address. Logs are also analyzed the following morning and the reports are e-mailed. Also the script schedules itself to run the following day. Finally the script can be set up to keep only one day's copy of backups or do a two-day rotation.
THIS VBSCRIPT ENUMERATES ALL INFORMATION STORES
AND CREATES NECESSARY BACKUP JOB SELECTION FILES AND BATCH FILES
THEN IF REQUESTED IT RUNS THE BACKUP JOBS
THEN IT SCHEDULES ITSELF FOR THE NEXT DAY
AFTER EACH BACKUP JOB, IT SENDS BACKUP LOGS TO A SPECIFIED E-MAIL ADDRESS
IT ALSO MAKES A SUMMARY OF ALL LOGS AND SENDS TO A SPECIFIED E-MAIL ADDRESS
IF REQUESTED IT CAN PEFORM A TWO-DAY BACKUP ROTATION
WRITTEN BY ANDREY FYODOROV - afyodoro(AT)bellsouth.net
Please run the script from a command prompt (DOS) window
cscript backupexchange.vbs - to setup and schedule backup jobs for tomorrow.
cscript backupexchange.vbs Rotate2 - to setup and schedule backup jobs for tomorrow using 2-day rotation.
cscript backupexchange.vbs BackupNow - to setup and schedule backup jobs for tomorrow and perform an immediate backup.
cscript backupexchange.vbs BackupNow Rotate2 - to setup and schedule backup jobs for tomorrow using 2-day rotation and perform an immediate backup.
COPY THE BACKUPEXCHANGE.VBS TO D:\NTBACKUP
THE SCRIPT ASSUMES THAT THE TARGET BACKUP VOLUME IS G:
IT CREATES G:\NTBACKUP DIRECTORY WITH \SELECTIONS, \CMDs, \LOGs, and \Exchange Backups SUBDIRECTORIES
Posted by Andrey Fyodorov at August 15, 2005 11:02 AM
Trackback Pings
TrackBack URL for this entry:
http://www.robichaux.net/cgi-bin/mt-tracker.cgi/1348
Comments
After searching and replacing D:\ with C:\ and G: with H: the script runs and attempts to launch ntbackup, but the backup doesn't actually do anything... I'm sent the emails, but with no logs attached...
After lookin at Event Viewer, I found that ntbackup was being issued with the /fu command and no such command param exists... At least on my Windows 2003 Server Standard...
Thanks
Posted by: Ryan at August 15, 2005 02:53 PM
NTBACKUP /FU switch stands for "File Unbuffered". It became available with Windows 2003 SP1.
http://www.microsoft.com/technet/itsolutions/msit/operations/exchbkup.mspx
If you can't implement this switch in your environment, search the script for all occurrences of /FU and remove them. There should be only two occurrences.
Posted by: Andrey Fyodorov at August 15, 2005 02:58 PM
To change drive letters from G: to something else, search for all occurrences of "G:" and "G_" and substitute your drive letter.
Posted by: Andrey Fyodorov at August 15, 2005 03:01 PM
Any chance of making those fields into customizable parameters at the beginning of the script so the users only have to mess with them once?
Posted by: Devin L. Ganger at August 16, 2005 04:42 AM
Yes, I am thinking about re-doing it and using constants for drive letters. When I first started writing it, it just poured out of me, and that's how it turned out, I couldn't stop :)
Posted by: Andrey Fyodorov at August 16, 2005 09:23 AM
Believe me, I understand! Welcome to the site, BTW; it's good to have you!
Posted by: Devin L. Ganger at August 16, 2005 01:11 PM
UPDATE 08/16/05: There was an annoying My Computer window popping up every time the script ran interactively. It turned out that a part of the DoSRS function was not tucked inside a proper If Then block, and on servers that don't have SRS it was calling the Shell with an empty command string.
Posted by: Andrey Fyodorov at August 16, 2005 05:05 PM
The script currently schedules a backup job for "6pm tomorrow" and the log summary job for "7am the day after tomorrow". I am thinking about changing the log summary to be scheduled at "7am tomorrow".
Posted by: Andrey Fyodorov at August 16, 2005 05:08 PM
Duhhh... I uploaded the script last night and forgot to change my domain's e-mail addresses to something generic. Got it fixed now, after I received someone's backup report. :)
Posted by: Andrey Fyodorov at August 17, 2005 10:02 AM
Hey, if you're getting backup reports at least you know the script's working :)
Posted by: Paul at August 18, 2005 07:25 AM
that was my goal - to get everyone's backup reports :)
Posted by: Andrey Fyodorov at August 18, 2005 07:51 AM
I have fixed one issue and slightly changed how the script schedules itself for the next run.
Posted by: Andrey Fyodorov at August 19, 2005 12:35 PM
Many thanks for the script.It would be nice to have the it schedule a System State backup as well.
Posted by: Brad at December 22, 2005 12:00 PM
I am having a little problem getting this to run as a scheduled task. I can manually run the "cscript exchangebackup.vbs backupnow rotate2" command from a command prompt and it runs successfully, howevever, the scheduled task does not. The scheduled task runs for a second and then finishes.
Any Ideas???
Posted by: Joe at February 3, 2006 11:54 AM
Can you use this on NT w/ Exch 5.5 to do backups?
Posted by: David at April 17, 2006 11:40 PM