Solved

Export MIcrosoft DNS structure and records

Posted on 2009-05-14
8
1,089 Views
Last Modified: 2012-05-07
Hi,
I've got about 100 DNS zones (mostly AD intergrated) and I need to export a list of the entie structure, including sub doimains and all hosts.
I've looked at various options with DNSCMD, but nothing seems to export everything.
Any thoughts?
Thanks.
0
Comment
Question by:undercover69
  • 4
  • 3
8 Comments
 
LVL 7

Expert Comment

by:dineesh
ID: 24385715
hi,

You will need to backup

From Registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server\Zones

If you dns records are stored on filesystem then this folder too..
From File system:
C:\WINDOWS\system32\dns

regards
Dinesh
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24385997

DNS Records aren't stored there if it's AD Integrated.

But DNSCMD does have a ZoneExport option that can be used.

Are you looking to get the zone files? Or a list of records in a non-DNS format?

Chris
0
 

Author Comment

by:undercover69
ID: 24386048
I don't really mind what format it is in, it's only for audit purposes to get an idea of the overall DNS structure, it's not going to be used to as a backup, or an import anywhere else.
It is predominantly the AD integrated ones I am after, I can grab the zone files for the other ones.
Thanks!
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 70

Expert Comment

by:Chris Dent
ID: 24386141

Then a tiny bit of VbScript will get them all for you :)

If it needs to run remotely you need to add the server name into each DNSCMD call. However, it'll create the export on the server in %SystemRoot%\System32\DNS whatever you do.

HTH

Chris
Set objShell = CreateObject("WScript.Shell")
arrOutput = Split(objShell.Exec("dnscmd /EnumZones /Primary /Ds").StdOut.ReadAll, vbCrlf)
 
For Each strLine in arrOutput
  If Instr(strLine, "Primary") > 0 Then
    strZoneName = Split(strLine, " ")(1)
    WScript.Echo objShell.Exec("dnscmd /ZoneExport " & strZoneName & " Export-" & strZoneName & ".dns").StdOut.ReadAll
  End If
Next

Open in new window

0
 

Author Comment

by:undercover69
ID: 24410534
Hi chris,

Sorry for the delay in replying, and thanks for the code.

it works fine, execpt that it doesn't seem to export the sub-domians?

Thanks again for your time.
0
 
LVL 70

Accepted Solution

by:
Chris Dent earned 250 total points
ID: 24410694

Really? Sub-domains as separate zones? Delegated or local?

If you run this on its own does it return the zone name you're after?

dnscmd /EnumZones /Primary /Ds

Chris
0
 

Author Comment

by:undercover69
ID: 24410891
ah, please ignore me, I was doing something daft that I am not prepared to admit to here:-)

Thanks Chris, perfect mate, points coming your way.
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24410953

No worries :)

Chris
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

This article is intended as an extension of a blog on Aging and Scavenging by the MS Enterprise Networking Team. In brief, Scavenging is used as follows: Each record in a zone which has been dynamically registered with an MS DNS Server will have…
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 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