Home > Microsoft Exchange Tips > Exchange Server Administration Tips > Sample batch file script to run NTBACKUP on Exchange
Exchange Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

EXCHANGE SERVER ADMINISTRATION TIPS

Sample batch file script to run NTBACKUP on Exchange


Serdar Yegulalp
08.02.2005
Rating: -4.07- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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.

VIEW MEMBER FEEDACK TO THIS EXCHANGE TIP
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.

MEMBER FEEDBACK TO THIS TIP

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 SearchExchange.com:

  • 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 SearchExchange.com.

    Rate this Tip
    To rate tips, you must be a member of SearchExchange.com.
    Register now to start rating these tips. Log in if you are already a member.


    Submit a Tip




    Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


    RELATED CONTENT
    Exchange Server Administration Tips
    Top 10 Microsoft Exchange Server tips of 2008
    Database changes that enhance Exchange Server 2007 fault tolerance
    How continuous replication methods affect Exchange 2007 log shipping
    Analyzing Exchange ActiveSync data from .CSV report files
    How to run Exchange Management Shell cmdlets in Exchange Server 2007
    Eliminate .PST file use for secure email retention in Exchange 2007
    Exchange Server 2007 log shipping and continuous replication
    Benefits of backing up Exchange Server with Microsoft's DPM 2007
    Exchange Server 2007 replication and database transaction basics
    Microsoft Exchange Server 2003 database recovery methods

    Microsoft Exchange Server Backup and Disaster Recovery
    Database changes that enhance Exchange Server 2007 fault tolerance
    How continuous replication methods affect Exchange 2007 log shipping
    Exchange Server 2007 log shipping and continuous replication
    Benefits of backing up Exchange Server with Microsoft's DPM 2007
    Exchange Server 2007 replication and database transaction basics
    Microsoft Exchange Server 2003 database recovery methods
    Microsoft Exchange Server mailbox recovery using database portability
    Plan an Exchange 2007 standby continuous replication (SCR) deployment
    Recovering an Exchange Server 2003 store on a disaster recovery box
    Using the NTBackup tool for Exchange Server backup and recovery
    Microsoft Exchange Server Backup and Disaster Recovery Research

    Microsoft Exchange Server Administration Tools
    How to custom-configure a Microsoft Outlook 2007 install using OCT
    Top Exchange Server performance monitoring and troubleshooting tools
    Search and index Microsoft Outlook 2007 public folders
    Executing an .MSP customization file in Microsoft Outlook 2007
    Using the NTBackup tool for Exchange Server backup and recovery
    Tools to bulk modify Active Directory users in Exchange Server 2003
    Free tools keep Microsoft Outlook visible in Windows Vista
    Setting up email disclaimers and signatures in Exchange Server
    Tool deploys customized Microsoft Outlook 2007 configurations
    Third-party Exchange Server 2007 backup and restore tools
    Microsoft Exchange Server Administration Tools Research

    RELATED GLOSSARY TERMS
    Terms from Whatis.com − the technology online dictionary
    Remote Installation Service  (SearchExchange.com)
    TCPMAN  (SearchExchange.com)

    RELATED RESOURCES
    2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
    Search Bitpipe.com for the latest white papers and business webcasts
    Whatis.com, the online computer dictionary

    DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



  • Email Server Solutions: Exchange 2007, Exchange 2003, Exchange 2000, SharePoint
    HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Site Map




    All Rights Reserved, Copyright 2004 - 2009, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts