Problem solve Get help with specific problems with your technologies, process and projects.

Sample batch file script to run NTBACKUP on Exchange

A sample batch file script that will guide NTBACKUP through a full backup of your System State and Exchange information store.

Backup solutions for Exchange abound, but there's one built right into Windows Server itself: command-line/GUI backup tool, NTBACKUP, which can be scripted with a batch file and made into a fairly powerful automated Exchange backup solution.

Here is a sample batch-file script to have NTBACKUP perform a full backup of the System State and Exchange information store. The script writes two backup files -- dirbackup.bkf (the directory services information) and exchbackup.bkf (the Exchange information store data) -- to the D: drive on the local machine (the location can be changed freely).

Because of possible conflicts, the two backups -- of directory services and the Exchange store -- should be performed separately.

You'll need to make a few changes to the script before it can run. <exchange_server> needs to be replaced with the name of your Exchange server, such as \\exch1.

This particular script also assumes that, when run, Exchange will be stopped for the sake of the backup operation --hence, the net stop commands. Consequently, the best time to run this backup operation should be at a time of low demand, like 4 a. m.

If you have the "Exchange-aware" version of NTBACKUP (i.e., the one included with all versions of Windows since Windows NT 4.0 SP3), and Exchange 2003 SP1 or later, it should be possible to run the backup cycle without the net stop and net start commands. However, experiment first to see if you can do this without logging errors.

Also, be mindful of failures in the logs, since a failed backup can create a condition where the Exchange store spontaneously dismounts, as outlined in Microsoft Knowledge Base article 812962.

If you want to back up to tape rather than a network drive, remove the /F option (and the corresponding filename) and replace it with /T "<name_of_tape >" -- where <name_of_tape> is of course the name of the tape to use (which must be added to the media pool and initialized beforehand).

[Text of script]

net stop MSExchangeSRS

net stop MSExchangeMGMT

net stop IISAdmin /Y

net stop MSExchangeSA /Y

ntbackup backup /f "D:<dirbackup.bkf" /j "Directory services backup"
DS "<exchange_server>" /d "Directory services backup
set created %date% %time%" /v:yes /r:no /rs:no

ntbackup backup /f "D:<exchangebackup.bkf" /j "Exchange server backup"
IS "<exchange_server>" /d "Exchange backup set created
%date% %time%" /v:yes /r:no /rs:no

net start MSExchangeSRS

net start ExIFS

net start IISAdmin

net start MSExchangeSA

About the author: Serdar Yegulalp is editor of the Windows Power Users Newsletter.


Are there any batch files out there to run a scheduled System State backup on a Windows 2000/2003?
—Jim S.


NTBACKUP lets you create a System State backup from the command line, so it would be pretty easy to create such a batch file:

ntbackup backup systemstate /F <filename>

(Use the /F switch to designate the backup file name, or the other command-line switches to designate the other media to use.)
—Serdar Yegulalp, tip author


I want to back up only the individual mailboxes -- or certain mailboxes -- in Exchange 2003 using NTBACKUP. How can I do that?
—Linford G.


There are many very good reasons why it's not a wise idea to try and back up individual mailboxes, also known in Exchange parlance as "brick-level backup>." Aside from being terribly slow (especially if you have a lot of mail in a given set of folders), it also places the information store into an inconsistent state. Microsoft doesn't recommend doing it, and neither do I, and everyone I can think of who has attempted to swim upstream against this particular current has eventually been dragged under.

The main reason people want to do mailbox-level backups is so they can perform mailbox-level restores. Exchange 2003 provides a way to do this -- at least semi-elegantly -- using Recovery Storage Groups.

Your best bet is to devise a good global backup strategy instead of a potentially broken piecemeal one.
—Serdar Yegulalp, tip author

Do you have comments on this tip? Let us know.

Related information from

  • Tip:NTBACKUP caveat for Exchange and system state backups
  • Expert Advice:Restoring an NTBACKUP file from one Exchange server to another
  • 20 tips in 20 minutes:Protecting and recovering Exchange 2003 data
  • Learning Center:The Exchange Server Backup and Recovery Toolbox
  • Learning Center: Toolbox for Exchange administrators
  • Reference Center: Exchange backup and recovery tips and resources

    Please let others know how useful this tip was via the rating scale below. Do you know a helpful Exchange Server, Microsoft Outlook or SharePoint tip, timesaver or workaround? Email the editors to talk about writing for

  • Dig Deeper on Exchange Server setup and troubleshooting