Automating MS Exchange Server 5.5 Backup With NTBackup.

by Lee Derbyshire [Published on 19 April 2002 / Last Updated on 19 April 2002]

While most Exchange admins are agreed on the necessity of performing regular backups, not all agree on which is the best way to do it. In fact, many Exchange newcomers are surprised at how strongly some admins feel regarding the superiority of one method compared to another.

Introduction

While most Exchange admins are agreed on the necessity of performing regular backups, not all agree on which is the best way to do it. In fact, many Exchange newcomers are surprised at how strongly some admins feel regarding the superiority of one method compared to another.

There are two main camps; those who do 'online' backups, and those who do 'offline' backups. The ones doing offline backups are prepared to tolerate certain disadvantages (such as the unavailability of the server during the backups) for the sake of simplicity, and are frequently motivated by annoyance at the discovery that their already expensive backup software requires them to buy an Agent to backup their email system. The ones doing online backups disdain this approach, bite the bullet, and buy the Agent. Actually, the online backup camp is further divided into those doing 'Brick Level' backups, and those who detest them, but that's another story.

As someone who can appreciate both sides of the argument, I'm not going to argue for one case or the other. This article is aimed at the Exchange admin who has already decided to do an online backup, and will describe how an automated Exchange online backup can be performed with native Windows NT utilities.

The NTBackup utility bundled with Windows NT is, to say the least, rather basic. However, when you install MS Exchange Server onto your NT Server something miraculous happens to it. It is replaced by an Exchange-aware version that can do something that most third-party backup software can't do without extension, namely; an online MS Exchange backup.

Those who have experimented with NTBackup may bemoan the fact that while this is indeed a nice feature to have, the lack of any scheduling facilites means that it still can't be seriously considered as a convenient backup option. Fortunately, the NT Task Scheduler service comes to our rescue, and the combination of NTBackup and the Task Scheduler becomes, all of a sudden, much more interesting.

Rather less fortunate is the fact that two different backup programs can't generally share the same tape, so this method requires that either you use NTBackup for all your backups, or use a dedicated tape drive for your Exchange backups (although the drive doesn't have to be on the Exchange server). If you can live with these restrictions then please read on...

Procedure

As previously mentioned, the NTBackup program is greatly enhanced by the installation of Exchange Server. The most interesting of these enhancements, from the point of view of the Exchange admin wishing to do a scheduled backup, is the addition of some command-line switches. These are ds , which instructs NTBackup to backup the Directory, and is , which backs up the Information Store. This means that we can do an online Exchange backup using a simple batch file. We can create this batch file from the command prompt as shown in figure 1, or you could use Notepad if you prefer. The batch file in this example is called EX_BACK.BAT and contains the single line ntbackup backup ds SRVR-1 is SRVR-1 /t normal. Please note that you will need to supply the name of your own server, not SRVR-1 as shown here. Enter CTRL-Z to stop copying from the console to the file if you are using the command line.


Fig. 1 - Creating a batch file from the NT Command Prompt.


NTBackup has other options that may be of interest in this situation, such as; /hc:on, which turns on hardware compression. You can see even more options by running Backup from the Start Menu and looking up 'switches, command-line' in the Help system.

Okay, so we have a batch file that will back up our Exchange server, how do we then automate it? First, we need to check that the Task Scheduler service is set to run automatically. Do this from the Services applet in Control Panel. If it isn't running automatically, change its startup parameters and click the 'Start' button.


Fig. 2 - The Task Scheduler service.


Having reassured ourselves that the Task Scheduler is running, we can add scheduled tasks by using the AT command. AT has many useful switches which you can find out about using the Windows NT Help system. The combination of switches used in this example will cause the EX_BACK.BAT file that we have just created to be run at midnight each weekday. Simply enter at 00:00 /every:M,T,W,Th,F c:\ex_back.bat at the NT command prompt as shown in figure 3. You can also enter at with no parameters to check the list of tasks in memory. Scheduled tasks even survive a server reboot, so once you've entered it, you can forget it.


Fig. 3 - Adding a scheduled task using AT.


And that's it. If you have the time to become more familiar with the command-line switches of NTBackup and AT, you'll find that there is actually quite a wide range of backup options available to you.

Also, if you would like to reassure yourself that your backup is taking place when it is supposed to (and this is a good idea!), and you don't want to hang around until midnight to see it happen, you can use the /l switch with NTBackup just to make sure that it is, for example; ntbackup backup ds SRVR-1 is SRVR-1 /t normal /l c:\ex_back.log.

Featured Links