4

I have a few zones in my Windows Server DNS.

I wish to add around 50 unique aliases to the existing zone. Is there any trick I can use? I've tried to google for it where the odd post suggests using dnscmd .. but I'm not sure if this is right and if so, how AND what the file format should be.

Assume that all the aliases are in a file.

eg.

test10 Alias(CNAME) www.foo.com

of course, I can wire up the file into any format and columns, required.

Pure.Krome
  • 6,338
  • 17
  • 72
  • 86

1 Answers1

4

If the records are already in a file, your best bet may be to edit the existing zone file directly (usually in the %SystemDir%\System32\dns folder). Open the file for the zone in question and paste the records in at the bottom of the file. Ensure the record format is the same as existing records (for example, it's simply CNAME rather than Alias(CNAME) and the fully-qualified alias name (on the right) should have a period at the end to designate it as a fully-qualified domain name.

Once your edits are complete, load the DNS control panel, find the domain, right-click and select Reload to have it read the file back into memory with the changes.

Note: Don't forget to make a backup of the original file before you begin editing, and don't forget to increment the serial number so any secondary servers will know to pull a zone transfer. This assumes the zone was set up to use a file (standard) rather than some other data source for its zone information.

The DNSCMD tool can be used to add records to a zone programmatically through a batch file if needed, but for 50 records in one zone it's probably easier to just paste them in directly rather than trying to convert it to a batch file.

Justin Scott
  • 8,748
  • 1
  • 27
  • 39
  • When I goto that file location on the server, it only lists one of the zones as a file (i have maybe 10 zones) and when i look in that file .. it has no subdomains listed at all .. when the zone currently has maybe 20 or so aliases and a number of subdomains with aliases, etc. I think the data is in active directory ??? ????? ? ? ?? – Pure.Krome Oct 11 '11 at 05:36
  • In the DNS control panel, select the zone in question, right click, then choose Properties. The `General` tab will tell you if it is an Active Directory-Integrated zone or not. Alternately, it will say "Primary" and specify the filename that the data is stored in. If it is an AD-Integrated zone, then editing through the control panel or using `dnscmd /recordadd` are the only ways I am aware of to manage records. On the command line it would be `dnscmd /recordadd example.com test10 CNAME foo.com` – Justin Scott Oct 11 '11 at 05:52
  • It's AD integrated. Is there a way to put all the CNAMES in a file, and then load it? or do i have to find out how to use powershell and recurse through all the contents of a file, and call that dnscmd for each row? – Pure.Krome Oct 11 '11 at 05:55
  • I wouldn't worry about PowerShell and looping over the contents, just paste in `dnscmd /recordadd example.com ` at the beginning of each line, ensure the RR types are correct (`CNAME` vs. `Alias(CNAME)`) and name the file with a `.bat` extension and run it as a batch file. – Justin Scott Oct 11 '11 at 06:01
  • AHH! and have this in a bat file :) awesome. forgot about dat. cheers! – Pure.Krome Oct 11 '11 at 06:09
  • Worked perfectly. cheers! – Pure.Krome Oct 11 '11 at 06:24