How to apply a new record to all DNS zones on Plesk server for Windows?

Created:

2016-11-16 13:03:16 UTC

Modified:

2017-05-02 10:32:13 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to apply a new record to all DNS zones on Plesk server for Windows?

Applicable to:

  • Plesk 11.5 for Windows
  • Plesk 12.0 for Windows
  • Plesk 12.5 for Windows

Question

  1. How to add a DNS record to multiple existing DNS zones?

  2. How to apply changes made in server-wide DNS template to existing DNS zones?

Answer

In Plesk for Windows changes in the server-wide DNS template are applied only to newly created zones.

To make changes in DNS records of multiple domains use one of the following.

Note : Before performing the below actions, create a backup of psa database:

"%plesk_dir%\MySQL\bin\mysqldump.exe" -uadmin -p***** -P8306 psa > C:\psa_current.sql
  1. If it is needed to add one record to multiple zones, use the following instructions:

    • Save list of domains to a text file domains.txt :

      "%plesk_bin%\dbclient.exe" --direct-sql --sql="select name from domains" > C:\domains.txt
      

      At this point, file domains.txt can be edited. To leave certain domains unchanged, just remove them from the list.

    • Add the TXT record to DNS zone of each domain listed in domains.txt:

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

      NOTE: If is is needed to remove existing TXT record, use the following command:

      for /f "skip=1" %i in (C:\domains.txt); do ("%plesk_cli%\dns.exe" -d %i -txt "text_record");
      
  2. If it is needed to apply server-wide DNS templates to multiple zones, use the following instruction:

    • Save the list of domains and their IP addresses to a text file domains_ip.txt :

      "%plesk_bin%\dbclient.exe" --direct-sql --sql="select domains.name as domain, IP_Addresses.ip_address from domains, dom_param, IP_Addresses where domains.id=dom_param.dom_id and dom_param.val=IP_Addresses.id and dom_param.param='ip_addr_id'" > C:\domains_ip.txt
      

      At this point, file domains_ip.txt can be edited. To leave certain domains unchanged, just remove them from the list.

      To get the list of domains that belong to a particular reseller, run the following command:

      mysql> select name from domains where cl_id in (select id from clients where vendor_id=<reseller_id>) order by name;
      
    • Run dns.exe --reset for DNS zone of each domain listed in domains_ip.txt. Attention! All custom DNS records will be removed:

      for /f "skip=1 tokens=1,2" %a in (C:\domains_ip.txt) do @"%plesk_cli%\dns.exe" --reset %a -ip %b
      
Have more questions? Submit a request
Please sign in to leave a comment.