Commas are inserted in DNS TXT records where spaces should be - using vb script to create DNS records
Posted on 2007-08-08
I need to add SPF records for over a thousand domains in microsft DNS.
I wrote a vd script a while back that facilitates this for me for normal a records, etc.
I modified the script to loop through all our domains and a SPF record - it's really a TXT DNS record.
Here's the code:
set wshell = createobject("wscript.shell")
wshell.run "%comspec% /c C:\Windows\system32\dnscmd.exe localhost /RecordAdd " & domain & " @ TXT v=spf1 mx a:bbbmail.com ~all", 0, True
set wshell = nothing
This adds a record, but there are commas after the spaces in the string:
v=spf1, mx, a:bbbmailout2.com, ~all
It should look like:
v=spf1 mx a:bbbmailout2.com ~all
When I manually add a record, it works fine.
When I check the record, there are no commas but it displays with line breaks like so:
I'm not sure if the VB is inserting the commas or linebreaks or the DNS MMC is interpretting the line breaks with commas.