none
How to import to DNS from Host file

    Question

  • I work for a large corporation and help manage our 200+ Cisco devices.  We have these devices mapped to IP addresses with a host file.  I have been tasked with getting those devices and ~300+ more devices listed in DNS with A records.  I have done a bit of looking and could not find a method that would allow me to take either a text file or csv file and import those into an existing AD primary DNS zone.  Anyone have an idea on this?
    Thursday, May 06, 2010 4:38 PM

Answers

  • The only idea that I can come up with that would possibly work for you is that you can create the DNS zone initially as a primary standard zone (not AD integrated).  Take the DNS zone file (its a txt file) and edit it manually using a text editor such as notepad.  Copy the entries from your HOSTS file into the DNS zone file.  Then format the information properly (dns record syntax).  Copy the file back to the DNS server and start the services and load the zone using that file.

    Once you have validated that the zone came up properly, covert the zone to AD integrated (zone properties, general tab).

     


    Visit my blog: anITKB.com, an IT Knowledge Base.
    • Marked as answer by Tiger Li Tuesday, May 11, 2010 5:36 AM
    Thursday, May 06, 2010 6:15 PM
  • Hi WilliamHuber,

    From my knowledge, I believe that there hasn't a tool out there that we may use to import record from txt or CSV files. However, you can achieve your goal with the batch file with DNScmd utility indirectly.

    1.Input the host file’s record to excel  , format the record to host and domain with the “text to columns” feature .
    2.Input the domain zone (If you need to create a new zone for those DNS records) and hosts record to DNS server

    dnscmd [<ServerName>] /zoneadd <ZoneName> <ZoneType>

    dnscmd [<ServerName>] /recordadd <ZoneName> <NodeName> <RRType> <RRData>

    For batch operation, I suggest you to write all command in one batch file and execute it.

    Here are some articles about DNScmd utility for you reference

    Dnscmd Overview

    http://technet.microsoft.com/en-us/library/cc778513(WS.10).aspx

    Dnscmd Syntax

    http://technet.microsoft.com/en-us/library/cc756116(WS.10).aspx#BKMK_14

    Thanks.

    Tiger Li

    • Marked as answer by Tiger Li Tuesday, May 11, 2010 5:36 AM
    Friday, May 07, 2010 6:31 AM
  • I can import from CSV using PowerShell, what format do you have?

    For instance, it may be:

    Import-CSV "YourFile.csv" | %{ New-DnsRecord -Name $_.Name -Zone domain.com -RecordType A -Address $_.IPAddress -Server YourDnsServer }

    It will possibly need more work than that, but not much more. In the example above, Name and IPAddress are the column names from the CSV.

    You would need these two:

    http://support.microsoft.com/kb/968929

    http://code.msdn.microsoft.com/dnsshell

     

    Chris

    • Marked as answer by Tiger Li Tuesday, May 11, 2010 5:36 AM
    Friday, May 07, 2010 7:42 AM

All replies

  • The only idea that I can come up with that would possibly work for you is that you can create the DNS zone initially as a primary standard zone (not AD integrated).  Take the DNS zone file (its a txt file) and edit it manually using a text editor such as notepad.  Copy the entries from your HOSTS file into the DNS zone file.  Then format the information properly (dns record syntax).  Copy the file back to the DNS server and start the services and load the zone using that file.

    Once you have validated that the zone came up properly, covert the zone to AD integrated (zone properties, general tab).

     


    Visit my blog: anITKB.com, an IT Knowledge Base.
    • Marked as answer by Tiger Li Tuesday, May 11, 2010 5:36 AM
    Thursday, May 06, 2010 6:15 PM
  • Hi WilliamHuber,

    From my knowledge, I believe that there hasn't a tool out there that we may use to import record from txt or CSV files. However, you can achieve your goal with the batch file with DNScmd utility indirectly.

    1.Input the host file’s record to excel  , format the record to host and domain with the “text to columns” feature .
    2.Input the domain zone (If you need to create a new zone for those DNS records) and hosts record to DNS server

    dnscmd [<ServerName>] /zoneadd <ZoneName> <ZoneType>

    dnscmd [<ServerName>] /recordadd <ZoneName> <NodeName> <RRType> <RRData>

    For batch operation, I suggest you to write all command in one batch file and execute it.

    Here are some articles about DNScmd utility for you reference

    Dnscmd Overview

    http://technet.microsoft.com/en-us/library/cc778513(WS.10).aspx

    Dnscmd Syntax

    http://technet.microsoft.com/en-us/library/cc756116(WS.10).aspx#BKMK_14

    Thanks.

    Tiger Li

    • Marked as answer by Tiger Li Tuesday, May 11, 2010 5:36 AM
    Friday, May 07, 2010 6:31 AM
  • I can import from CSV using PowerShell, what format do you have?

    For instance, it may be:

    Import-CSV "YourFile.csv" | %{ New-DnsRecord -Name $_.Name -Zone domain.com -RecordType A -Address $_.IPAddress -Server YourDnsServer }

    It will possibly need more work than that, but not much more. In the example above, Name and IPAddress are the column names from the CSV.

    You would need these two:

    http://support.microsoft.com/kb/968929

    http://code.msdn.microsoft.com/dnsshell

     

    Chris

    • Marked as answer by Tiger Li Tuesday, May 11, 2010 5:36 AM
    Friday, May 07, 2010 7:42 AM