How to clone Windows Server 2012 r2 DNS Server configuration from one server to another

domain-name-systemwindows-server-2012-r2

I am trying to export all the configuration settings from a "corporate" DNS server to my local DNS server (both systems use Windows Server 2012 r2) for testing and I am unsure as for how to do that. I explored dnscmd and the dnscmd /exportsettings (all this does write server configuration information to a text file) but haven't had much luck finding a solution.

I have also tried using a backup (http://c-nergy.be/blog/?p=1837) and restore script (http://c-nergy.be/blog/?p=1858) but these scripts only backup/restore zone files and not other configuration settings such as conditional forwarders, etc.

What would be the best way to go about solving my problem?

Thank you in advance.

Best Answer

The zone information and DNS server settings are in different places.

  • Non-AD-integrated DNS server stores its zones as .dns files in %windir%\system32\dns. Copy these files besides cache.dns, that only contains cached DNS lookups.

    With AD-integrated DNS server the information is within AD and dns.exe performs many LDAP requests to gather this data when it starts. It's possible to Extract Active Directory-Integrated Zone Files with dnscmd /ZoneExport FQDN_of_zonename Zone_export_file, like you have done.

  • Settings are stored in the registry. Things are easy when AD isn't involved, as you can just export the settings with regedit /e and import by double clicking the .reg file on the target server. With AD-integrated installation you may need to check some values manually before importing. However, here's some registry locations where you can find your server settings:

    • HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\DNS Server\Zones (formerly HKLM\System\CurrentControlSet\Services\DNS\Zones) is the location in the registry related to the zone files: what zones the server has, what are their settings and where they should be obtained from. The same information that can be obtained with dnscmd /zoneinfo.

    • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS\Parameters is the location for server-level settings. It's the same information that can be obtained with dnscmd /info.

    • The other DNS Registry Entries aren't directly associated with the DNS Server.