Datamation Logo

Create a Record in DNS from a TXT File

September 26, 2005
Datamation content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More .

Author: Eugenio Talarico – eugeniotalarico at vodafone dot it

Platform: Windows

Type: Windows Script

Description:

The BAT file creates a series of records into DNS. It uses the LISTA.TXT file as input, wherein you have to specify the name of the record and its value.

If you open the BAT file you’ll see that after DNSCMD you have to also specify a server that contains the zone (SERVERNAME), the parameter /RecordADD to add the record, and the ZONE.

You can also dictate whether the record you want to add is a HOST or an ALIAS. To do so, you have to place the following between the RECORD_NAME and the value XXX.XXX.XXX.XXX or alias:

A = HOST
CNAME = ALIAS

so the result of the string inside the input.txt reads as:

RECORD_2_ADD;A;IP_ADDRESS

OR

RECORD_2_ADD;CNAME;ALIAS_WHERE_POINT

Download LocationLink

Scroll down to view the script.


Script Code:


BATCH FILE:


for /f "tokens=1-3 delims=;" %%a in (input.txt) do (dnscmd SERVERNAME/RecordAdd ZONE_WHERE_ADD_RECORD %%a %%b %%c >>insert.log)


Disclaimer: We hope that the information in these pages is valuable to you. Your use of the information contained in these pages, however, is at your sole risk. All information on these pages is provided “as – is”, without any warranty, whether express or implied, of its accuracy,
completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by me. I shall not be liable for any damages you
may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

  SEE ALL
APPLICATIONS ARTICLES
 

Subscribe to Data Insider

Learn the latest news and best practices about data science, big data analytics, artificial intelligence, data security, and more.

Datamation Logo

Datamation is the leading industry resource for B2B data professionals and technology buyers. Datamation's focus is on providing insight into the latest trends and innovation in AI, data security, big data, and more, along with in-depth product recommendations and comparisons. More than 1.7M users gain insight and guidance from Datamation every year.

Advertisers

Advertise with TechnologyAdvice on Datamation and our other data and technology-focused platforms.

Advertise with Us

Our Brands


Privacy Policy Terms & Conditions About Contact Advertise California - Do Not Sell My Information

Property of TechnologyAdvice.
© 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.