Backup Windows Domain Controller using NTBACKUP via cmd

Backing up your servers for disaster recovery these days much include your Domain Controller if you are utilizing a Windows Active Directory to manage your users. To do this is easy using a tool that comes installed on all Windows servers called NTBACKUP. Of course you can launch the GUI by entering NTBACKUP from the run or command line. However, this does not make automated backup work very well. So here is the .bat file that I use to execute it via Windows Scheduled tasks:

@echo off
:: variables
set logfile=D:\backup_log_file.txt
 
echo %Date% # # # Backing up system state containing: local Registry, COM+ Class Registration Database, System Boot Files, Certificates(if certificate server installed), Cluster database(if installed), NTDS.DIT, and SYSVOL folder >> %logfile%
ntbackup backup systemstate /J "System State Backup Job" /F "D:\system_state_backup.bkf" >> %logfile%
 
echo %Date% Backup Completed! >> %logfile%

(NOTE: I am doing this backup via an internal network and using a user account that exists on both systems. Security may dictate that you handle this differently based on your circumstances.)

After the file is executed by Windows Scheduled Tasks you will then be left with a file that is ready to backup somewhere. I do this by making a copy to another server by using the methods covered in a previous blog post at Windows backup bat script using xcopy.

Published by

Adam

Application Architect from Florida

Leave a Reply

Your email address will not be published. Required fields are marked *