Bulk add TXT DNS Record to Zones in Windows

This content 8 years old. Please, read this page keeping its age in mind along with the fact technology changes fast and the information on this page me be outdated, not best practice, or plain wrong.

Had more than a handful of domains I needed to add TXT record for in Windows DNS (2003). I did it using dnscmd from 2003 Toolkit and command line.

This will enumerate the zones (I search for Primary and exclude reverse):

dnscmd /enumzones | find /I Primary | find /V Rev > zones.txt

After I have a zones.txt file, I then loop through it to add the TXT record.

for /f %x in (zones.txt) do dnscmd . /recordadd %x @ TXT v=spf1 mx -all

Speak Your Mind


This site uses Akismet to reduce spam. Learn how your comment data is processed.