Link to home
Start Free TrialLog in
Avatar of undercover69
undercover69

asked on

Export MIcrosoft DNS structure and records

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.
Avatar of dineesh
dineesh
Flag of India image

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
Avatar of Chris Dent

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
Avatar of undercover69
undercover69

ASKER

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!

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

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.
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.

No worries :)

Chris