Solved

Export MIcrosoft DNS structure and records

Posted on 2009-05-14
8
1,079 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
 
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
I will assume you are running a non-server version of some sort of Windows throughout this article. There are many flavors of Windows since Windows Server 2000 - 2008, XP Home & Pro, Vista Home & Pro, and Windows 7 Starter, Home, Pro, Ultimate, etc.…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

19 Experts available now in Live!

Get 1:1 Help Now