Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Friday, October 17, 2014 2:57 PM
Hi,
I need to create multiple reverse lookup zones which I can add on DNS Manager.
Once I have created the reverse lookup zones, I was hoping whether I can import PTR records into the zones. So what I have done is created a .txt file for example with the following entries in the text file: -
105 testhost01.domain.local 0.168.192.in-addr.arpa
106 testhost02.domain.local 1.168.192.in-addr.arpa
107 testhost03.domain.local 2.168.192.in-addr.arpa
From the above saved txt file, I have downloaded the below command line: -
For /f "tokens1-3" %i in (C:\test.txt) do dnscmd %LOGONSERVER% /RecordAdd %k %i PTR %j
Is the above command linecorrect? (I can confirm the .txt file is saved in that location as a test) Can someone please advise where I am going wrong?
Many thanks.
Monday, October 20, 2014 2:51 AM ✅Answered
Hi,
Based on your description, I have tested this command in my lab. Yes, we can use it to add PTR records into the zones. But we forgot an equal sign in the example, it should be for /f “tokens=1-3” %i in (c:\a.txt) do dnscmd dc1w12r2.sita.lab /recordadd %k %i PTR %j. When we enter this command in command prompt, then press Enter, there will be three dnscmd /recordadd commands were performed.
Best Regards,
Tina
Monday, October 20, 2014 8:47 AM
One other question I have: -
If I were to export an existing zone let's say 0.168.192 which has hundreds of PTR records and I want to create new zones 1.168.192, 2.168.192, 3.168.192 and so on - what would be the best action of exporting this whole zone (0.168.192) and importing certain records from this zone into the new zones?
For example 0.168.192 around 200 PTR records to be exported and then these records to be imported into the new zone 1.168.192?
Would a CSV be achievable? And if so, what columns and command line I would have to run?
Many thanks.
Mo
Wednesday, October 22, 2014 10:11 AM
Hi,
We can also use the method above to import these PTR records.
At first, export the PTR records.
Right click the reverse lookup zones which you want to export (i.e. 0.168.192.in-addr.arpa), click Export List. Save it as a .txt file (i.e. a.txt).
For example, the PTR records in the a.txt is 192.168.2.106 Pointer (PTR) test2.sita.lab. static
Then, modify the a.txt file.
Open a.txt file, click Edit, click Replace.
In the Find what box, enter 192.168.0. , click Replace All. The PTR records is 106 Pointer (PTR) test2.sita.lab. static
Finally, run this command,
for /f “skip=n tokens=1,4” %i in (c:\a.txt) do dnscmd servername /recordadd 1.168.192.in-addr.arpa %i PTR %j
skip=n, specifies the number of lines to skip at the beginning of the file.
In addition, PTR records create a pointer that maps an IP address to a host name for reverse lookups. When we new a PTR record in a reverse lookup zone in DNS manager, in fact, we have specified the network segment. If we export the PTR records in 0.168.192.in-addr.arpa to 1.168.192.in-addr.arpa, the same host name correspond to different IP addresses.
Best Regards,
Tina
Tuesday, March 7, 2017 3:53 PM
If I wanted to add multiple PTR records (contained in the c:\a.txt file) for a list of DNS servers (contained with c:\computerList.txt), what would I have to modify in the statement:
for /f “tokens=1-3” %i in (c:\a.txt) do dnscmd dc1w12r2.sita.lab /recordadd %k %i PTR %j
Thanks,
Mark