DNS Zone Recovery using Powershell

Recover the DNS zone

In case you’ve accidentally deleted a DNS zone it’s good to know how to recover asap and get the deleted zone back in your production environment. I’m using a DNS zone export as a backup of the zone that has been deleted.

We admins are lazy so this is the most convenient way to recover a DNS zone. Yest you can also recover by using Authoritative Restore and use ntdsutil but it’s way more time consuming.  So it’s good to think about scheduling a powershell script that makes an export weekly or daily and writes the export file to a dedicated location.

1. Create the DNS zone with your existing export file. 

Use this powershell cmdlet:

Add-DnsServerPrimaryZone -name yourdomain.local -zonefile yourexport.file -loadexisting

 

DNS

2. Change the imported zone to primary type. This can also be achieved using the DNS Powershell cmdlet ConvertTo-DnsServerPrimaryZone.

DNS Zone Type

3. Enable Active Directory Integrated.

DNS Active Directory Integrated

4. Click Yes

DNS click Yes

5. Change Dynamic Update and Aging Settings back to original or DR required settings. Click Change Replication Scope.

DNS change settings

6. Select Forest DNS or Domain DNS Server replication scope.

DNS to forest

DNS zone recovered 

Just to be sure, verify the health of replication

DNS Repadmin

Now with these simple steps you’ve recoverd your deleted DNS zone.