Solved

Backing Up a Primary DNS Server with PowerShell

Posted on 2013-06-28
6
2,227 Views
Last Modified: 2013-07-05
I'm attempting to backup a primary, non-Active Directory, DNS server with PowerShell. It's a Windows Server 2012 Standard server with all of the updates applied, and only the DNS role installed.  I found the code from this TechNet example.

#Get DNS Server configuration and store it in ServerConfig.xml 
Get-DnsServer | Export-Clixml -Path ServerConfig.xml 

Open in new window


This part worked great, and spit everything out into an XML file. I ran through the file, and verified that all of the forward lookup zones, reverse lookup zones, and conditional forwarder zones were there.

I attempted to restore the XML configuration to another Windows Server 2012 Standard server with the DNS role installed using the restore command.

#Import the configuration from ServerConfig.xml and set it on TargetServer through CimSession 
Import-Clixml -Path ServerConfig.xml | Set-DnsServer –CimSession TargetServer

Open in new window


The problem is only the conditional forwarder zones were restored. The forward lookup zones and reverse lookup zones didn't transfer.

Is there something I'm missing?
0
Comment
Question by:mattheweharding
  • 2
  • 2
  • 2
6 Comments
 
LVL 15

Expert Comment

by:Rob Stone
ID: 39285701
It's stating that it is only backing up the server configuration, not the zone's.

This link has a PS script to backup the DNS zones:
http://c-nergy.be/blog/?p=1837

Restore DNS zones:
http://c-nergy.be/blog/?p=1858

If you just want to copy the zone's over, you can take a copy of the DNS file in %systemroot%\system32\dns and copy that to the other DNS server.
0
 

Author Comment

by:mattheweharding
ID: 39285708
I've tried that script on Server 2012, and didn't work.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39286084
See example 1 from following article..
http://technet.microsoft.com/en-us/library/jj649845.aspx
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:mattheweharding
ID: 39290005
Same problem with that script. Only the conditional forwarders are created. Not the forward and reverse lookup zones.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39300817
Are you getting ay warning or Error?
0
 
LVL 15

Accepted Solution

by:
Rob Stone earned 500 total points
ID: 39301543
This also works, although it's a bit cumbersome:

Exported a zone using the following cmdlet
Export-DnsServerZone -Name zonename.local -FileName ZonenameExport.local.dns

This exported the file to C:\Windows\System32\DNS.

I then copied the file to another DNS server, renamed it to Zonename.local.dns and ran the following command:
DNSCMD /ZoneAdd Zonename.local /Primary /File Zonename.local.dns /load

This then loaded the zone and records into DNS.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

What to do when Windows Update is not working correctly? What tools can I use to detect the cause of the malfunction problem? What does this numeric error code mean? These and other questions that you have been asking in the past are answered here (…
This article will help you understand what HashTables are and how to use them in PowerShell.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now