Bulk add TXT DNS Record to Zones in Windows

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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