Sunday, April 8, 2007

Script: Exchange 2007 backups with NTBackup

NTBackup is a great solution for Exchange disaster recovery without buying expensive additions to your current backup software. We use NTBackup to backup each Exchange database to its own backup file. Afterwards our primary backup software will send each of those files to tape. Here is a script we use to dynamically backup all the databases on our Exchange servers using NTBackup.

Optimizing NTBackup

Technet has a great article on how Microsoft IT uses NTBackup to backup their Exchange 2003 clusters. This article recommends some registry entries to help optimize performance as well as details about an enhanced NTBackup version that is included with Windows 2003 Service Pack 1. These performance enhancements cut our backup times by more than half. To start the script I set these registry values.

Compiling a Single Log File

Each backup process will create a log file in the format of backup##.log within the %userprofile%\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\ directory. The script will add the contents of the latest backup file to the backup log for the server.

Cluster Version

To backup our cluster we created separate cluster groups for our backup disk resource. This cluster group is moved to the corresponding active server to write the backup files. Afterwards it is moved to a passive server that sends the backup files to tape. We schedule this script to be run at the same time on all cluster nodes. It tests if a file path exists (that would be owned by an exchange virtual server) and if so perform the backup for the corresponding server node.

38 comments:

Excellent :) one thing though - not sure if i'm doing this correctly, but i found that $home was not available when running the script as a domain user using Windows Task Scheduler. As a result the backup logs were not being included in the email report.

This is great, move backup to a different machine, installed Exchange 2007 32bit management tools and editited your script. Worked like a charm. Took 30mins for a complete backup where on the exchange server it was taking 3 hours.

Do you think it would be possible to backup Exchange 2007 SP1 running on Windows 2008 Server remotely to a machine running Windows 2003 Server installed with Exchange System Manager using the 2003 NTBACKUP utility?

Me again - to clarify my question is it possible for me to send the backup file to a UNC drive? To my untrained eye it looks like the backup path variable sends this to the local disk, which for us wouldn't work because we have no disk space.

I exerpienced the same issue when the login name for the backup service account was changed and no longer matched the profile directory. I would suggest hardcoding the directory where NTBackup log files are stored instead of using: "$Home\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\"

Thank you -- I adapted this script for our setup in about 20 minutes and saved hours of work. This is a well-written and well-designed piece of work. My next step will be adding code to ship the backup files to Amazon cloud storage.

My nephew John told me about his complicated trouble. I knew that he had problems with Exchange data. I suggested him one determintion, which one of the best in the Inet in my opinion. What is more such application is able to help in this trouble - recover edb files.