How to add a DNS record to multiple existing DNS zones?
How to apply changes made in server-wide DNS template to existing DNS zones?
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
"%plesk_dir%"\\Mysql\\bin\\mysqldump.exe -uadmin -p***** -P8306 psa > c:\\psa_current.sql
If it is needed to add one record to multiple zones, use the following instructions:
1.1. Save list of domains to a text file
"%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.
1.2. 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");
If it is needed to apply server-wide DNS templates to multiple zones, use the following instruction:
2.1. Save the list of domains and their IP addresses to a text file
"%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;
2.2. 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