Windows Server 2012 R2: Backing up your DNS Records

About DNS, a one liner: You might already know this, but saying it once more, that AD DS is heavily dependent on DNS since it resolves the naming systems. Backing up your DNS records is always a good idea, suppose your server’s spindles are not moving anymore 😉 what would you do then? Restore it? From where? Alas! You haven’t backed up it yet, but if you have an OS image backed up somewhere you can restore the whole DNS server back again, but is time consuming. So, prevention is always better than cure.

FIRST, Simple Solution: Backing up primary and secondary zones independent of the system state is a pretty simple process. You can use the “xcopy” command to back up all zone text files on a DNS server. This command would back up the contents of the default DNS folder to the “C:\dnsbackup” folder:

xcopy %systemroot%\system32\dns c:\dnsbackup /y 

The “/y” switch “Suppresses prompting to confirm you want to overwrite an existing destination file.” Since it’s a text file it’s easier to backup. And you can restore it as well, but we will be talking about it in another post.

SECOND, Not So Simple Solution: The command I am going to use today is really getting obsolete, as Microsoft said so 🙂 see the screenshot below:

dnsexport_01

In both case whether you run the command from command prompt or from the PowerShell it will give you the same result.

But allow me to give you the second way to backup your DNS server’s zone data. Run the following command from the PowerShell:

dnscmd CORP /ZoneExport mobs-bd.org backup\mobs-bd.org.bkp1

And run the following at the same PS prompt:

dnscmd CORP /ZoneExport mobs-bd.org backup\_msdcs.mobs-bd.org.backup1

Here in my server “CORP” is the server name which holds the domain controller “mobs-bd.org”

Screenshot follows:

dnsexport_00

 

When you run the command, the /ZoneExport switch tells DNSCMD.exe that you want to export zone information for the specified zone (mobs-bd.org) to a backup file. The backup file will be placed in the %systemroot%\system32\dns\backup folder, and will be named mobs-bd.org.bkp1. same goes for the second command as  well. Moreover, you can see the folder view of the DNS container is full of txt files….and you can just copy them into a redundant drive or however you see fit.