Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Backing Up a Primary DNS Server with PowerShell

Posted on 2013-06-28
6
Medium Priority
?
2,791 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is comprised of the pearls we have garnered deploying virtualization solutions since Virtual Server 2005 and subsequent 2008 RTM+ Hyper-V in standalone and clustered environments.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
In this Micro Tutorial viewers will learn how they can get their files copied out from their unbootable system without need to use recovery services. As an example non-bootable Windows 2012R2 installation is used which has boot problems.
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…

688 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