Add DNS record via CLI


To add a DNS record to a specific domain via CLI I can use this command:
modify-dns --domain --add-record “ A”

But how can I add a DNS record to all domains so that “” is replaced with the correct domain name?

modify-dns --all-domains --add-record “foo A” ?



Try the following:

virtualmin list-domains --name-only | while read line ; do virtualmin modify-dns --domain-name $line --add-record "$line A" ; done

That should work, I don’t have a server I can test it on though so let me know if you have any issues. You only need to replace the IP address ( with what you want.