Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 12507
  • Last Modified:

Import DNS txt file into Windows DNS Server

In my company we have thousands of switches and routers with unique host names and I have list with all the host names and IP addresses that are in only 1 servers host file.  I wanted to import this host file into my 2 Windows Domain Controllers running DNS.  How do I import a TXT or CSV (either or) file into a Windows DNS server?
0
Ensilence
Asked:
Ensilence
1 Solution
 
bhanukir7Commented:
Hi,

i think this post on MS can help you. This post talks about reverse address zone but you can get help for  you text file by using the DNS import export tool

http://blogs.msdn.com/richpec/archive/2008/08/24/how-to-consolidate-many-reverse-dns-zones-into-fewer-larger-reverse-dns-zones.aspx

or use this which talks about importing text file to unix DNS (BINDS) and then importing that to windows dns server.



http://www.eggheadcafe.com/forumarchives/windowsserverdns/Aug2005/post23676167.asp

bhanu
0
 
Chris DentPowerShell DeveloperCommented:

> I wanted to import this host file into my 2 Windows Domain Controllers running DNS.  
> How do I import a TXT or CSV (either or) file into a Windows DNS server?

It actually works really easily using DNSCMD, a bit of playing in Excel and the drag down.

DNSCMD from the support tools has a /RecordAdd option we can use. All you have to do in Excel is complete the command :)

e.g.

Column A (RecordAdd and domain)
DNSCMD /RecordAdd youdomain.com

Column B (Name)
"Host Name"

Column C (Record Type)
A

Column D (IP Address)
1.2.3.4

Drag down columns A and C. Paste into Notepad, now you have have a batch file that can add all the records for you :)

If that's no good, there are scripting methods we can use for the more automated approach :)

Chris
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
bhanukir7Commented:
Hi Chris

That seems to be the easiest way.  Hope this would be helpful to the asker too.

bhanu
0
 
EnsilenceAuthor Commented:
Chris,

I will take a look at what the DNSCMD is and how it can help me.  Right now what I am working with is a users host file from the drivers\etc dir and has all the host names and IPs populated.  Like:
10.45.1.254   Site45rtr01
10.46.1.254   Site46rtr01
10.47.1.254   Site47rtr01
10.48.1.254   Site48rtr01
10.49.1.254   Site49rtr01
10.50.1.254   Site50rtr01
10.52.1.254   Site51rtr01

My Excell skills are old but you can teach this dog new tricks.  I will look at what you suggested about using Excel but I am wondering if there was an easier way to import this lame TXT file list into DNS and populate the A records etc. I am currently using or looking at dnsmgmt console.  Kind of clueless to this function I want to perform.  Limited research online had suggested editing a .DNS file or something...?  Any more words would likely be greatly appreciated.  
0
 
Chris DentPowerShell DeveloperCommented:

There's nothing simple in the DNS console that will let you I'm afraid.

If your zone were not AD Integrated you would have a text file for the zone file, that's the one with the .dns extension it would have hidden in %SystemRoot%\System32\DNS\. AD Integration moves that data into Active Directory itself as objects we won't be able to write directly.

We can, of course, write a script to rip apart the text file and construct the relevant records for us. And we could use WMI to add those in, it's not difficult if you're experienced with the interface at all.

However, using DNSCMD and the method described above will give you a much easier view of the changes if you aren't familiar with the scripting interfaces (either VbScript or PowerShell if I'm doing it).

I'm more than happy to show you the scripted methods if you prefer those :)

Chris
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Tackle projects and never again get stuck behind a technical roadblock.
Join Now