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
    Set up messaging records management (MRM) in Exchange Server 2007
    How Microsoft's new support policy for virtualized Exchange will affect you
    Why too much memory can hurt Exchange Server 2007 performance
    Microsoft Exchange Server backup method pros and cons
    Migrating .PST files to an Exchange Server information store
    Virtualizing Exchange Server 2007 with Microsoft's Hyper-V
    Configure SMTP connection limits in Exchange Server 2003 and SBS
    Five Microsoft Exchange Server backup worst practices
    How to export Global Address List data to Microsoft Office Access
    Create a group policy to prevent .PST file storage in Exchange 2007

    Microsoft Exchange Server Backup and Disaster Recovery
    Using the NTBackup tool for Exchange Server backup and recovery
    Microsoft Exchange Server backup method pros and cons
    Understanding Exchange Server 2007 backup and disaster recovery
    Five Microsoft Exchange Server backup worst practices
    Third-party Exchange Server 2007 backup and restore tools
    Re-enable Exchange Server 2007 remote streaming backups in SP1
    Managing an Exchange 2007 Cluster Continuous Replication (CCR) setup
    Managing an Exchange 2007 Single Copy Cluster (SCC) setup
    Managing Local Continuous Replication (LCR) in Exchange 2007
    Can I back up Exchange Server with a POP3 hosted email server?
    Microsoft Exchange Server Backup and Disaster Recovery Research

    Microsoft Exchange Server Administration Tools
    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
    Customizing an Outlook Web Access 2003 email signature
    Tool exports messages from Microsoft Outlook to Unix .EML file format
    Monitor mail flow with the Exchange Server 2007 Queue Viewer tool
    Use Performance Monitor to detect Exchange 2003 message queue problems
    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.

  • 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  |  Reprints  |  Site Map




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