Plesk

How to update all DNS records for multiple domains at once?

Question

How to update all DNS records for multiple domains at once?

Answer

Click on a section to expand

For one record:

  1. Connect to the server via RDP.

  2. Prepare the list of the domains. For example, in order to put all the domains on the server into the C:domains.txt file, use the following Command Prompt command:

    C:> "%plesk_bin%dbclient.exe" --direct-sql --sql="SELECT name FROM domains" > C:domains.txt

  3. Remove the existing A records from the domains:

    C:> for /f "skip=1" %i in (C:domains.txt); do ("%plesk_cli%dns.exe" -d %i -a "" -ip 203.0.113.2)

  4. Run the following command to add the new A records for the domains:

    C:> for /f "skip=1" %i in (C:domains.txt); do ("%plesk_cli%dns.exe" -a %i -a "" -ip 203.0.113.2).

For all records:

  1. Connect to the server via RDP.

  2. Prepare the list of the domains. For example, in order to put all the domains on the server into the C:domains.txt file, use the following Command Prompt command:

    C:> "%plesk_bin%dbclient.exe" --direct-sql --sql="SELECT name FROM domains" > C:domains.txt

  3. Remove all records for all domains:

    C:>for /f "skip=1" %i in (C:domains.txt); do ("%plesk_cli%dns.exe" --del-all %i)

  4. Run the following command to add all records for all domains specified in "":

    C:>for /f "skip=1" %i in (C:domains.txt); do ("%plesk_cli%dns.exe" -s %i -list "A,example.com,203.0.113.2;MX,mail3,mail.example.com,15;NS,ns2,ns.example.com").

Additional information

dns.exe: DNS Zones on Domains