How to export DNS Zone from one Windows Server and import to another (Non-AD DNS)

We are quickly just going to go through how to export DNS server zones from one Windows Server (I’m testing on 2019) to another. This is not for AD zones, this is short guide that is valid if you have simple DNS server which is not part of Active Directory.

Before we begin

There really is not much to say – we will export DNS zone from one server and import it to another. Important thing for you, if you are doing this with DNS that is part of Active Directory – this is not for you. There are other guides on the internet that explain how to do that. Process is simple, but still – not the same.

I have two Windows Server 2019 installation for this test. One (DNSTest1) is hosting one DNS zone named informatiker.test, and another WS2019 installation (DNSTest2) is emptu, has only installed DNS role on it, and is waiting for zone import.

Both machines are in Workgroup, so no domain.

As you can see, my DNS zone is not Active Directory integrated.

Export DNS Zones from DNSTest1 server

First, we are going to open Powershell (as admin) on the machine where are DNS zones are currently residing.

We are going to list all DNS zones that are currently on the server by typing in

Get-DNSServerZone

Ok, we need informatiker.test DNS zone. It is primary forward lookup zone.

You can do export with Export-DNSServerZone command or with dnscmd. We are going to use Export-DNS… command

Here is the sample. So, in my example “zonename” is the name of the zone I wish to export, and that is informatiker.test zone. Zonefilebackupname is the name we are going to give to the backup file of the informatiker.test zone. I’m going to name my file informatiker.test.bak

Export-DNSServerZone "<zonename>" "<zonefilebackupname>"

So, here is how my command looks like

And where is that backup file we created now? In C:\Windows\System32\dns folder

Ok, we are now going to copy informatiker.test.bak file to our new server, we wish to import DNS zone to – DNSTest2 server.

Import informatiker.test.bak to DNSTest2 DNS Server

I copied informatiker.test.bak from TestDNS1 server to TestDNS2 server. I copied it to the C:\Windows\System32\dns folder

Before next step make sure that in file explorer under View menu you enable hidden items and file names extensions

We are going now to rename informatiker.test.bak to informatiker.test.dns

Confirm you want to change file extension with Yes

Ok, now we have informatiker.test.dns file on DNSTest2 server.

But how are we going to import that file to our new DNS Server?

I’ll open DNS Manager on TestDNS2 server, expand my DNS server name, right click on Forward Lookup Zones and select New Zone

Next

Primary zone

I’m going to give exact same name to the zone as it was on the TestDNS1 server – informatiker.test

Next screen is most important one. We are going to select “Use this existing file” and informatiker.test.dns will appear. Notice how text below says that it has to be located in the Windows\System32\dns folder on the server. It is, we already did it. Next

I will not allow dynamic updates

Ok, moment of truth, we are done. Finish

Ok, let’s check DNS manager…

Everyhing I had on the TestDNS1 is now on TestDNS2 server.

If you right click on SOA record and select Properties you will notice that General tab and Start of Authority look the same as on your old server.

But, check out Name Servers, WINS and Zone transfers tab, these settings are not transfered!!

On Name Servers tab I see only DNSTest1 server, not TestDNS2

Zone transfers tab on TestDNS1 (server we exported from) for the informatiker.test zone

Zone transfers tab on TestDNS2 (server we copied to) informatiker.test zone

Go through all the tabs quickly, and check settings and records to be sure that everything is ok.

Whats next?

When you are sure all fits on your new DNS servers, redirect public IP (or private one) to your new DNS server, and shut down your old one. Also don’t forget to check that DNS goes through your firewall on your machine and on the router.

That should be it.

Disclaimer