Question
-
How to add a DNS record to several existing domains?
-
How to apply changes made in server-wide DNS template to several existing domains?
Answer
In Plesk for Windows, changes in the server-wide DNS template are applied only to newly created domains.
To make changes in DNS records of multiple domains, log in to the server via RDP, open Command Prompt and use one of the following scenarios:
Note: Before performing the below actions, create a backup of the psa
database:
C:> plesk db dump psa > C:psa_dump.sql
-
To add one record to several domains:
-
Save a list of domains to the
domains.txt
text file:C:> plesk db -N -e “select name from domains” > C:domains.txt
Note: edit the
domains.txt
file according to the requirements.To leave separate domains unchanged, remove them from the list.
-
Add the required DNS record, e.g. the
TXT
record, for each domain listed in theC:domains.txt
file:C:> for /f %i in (C:domains.txt); do @(“%plesk_cli%dns.exe” -a %i -txt “Text_Record”);
SUCCESS: Creation of DNS record in Domain ‘example.com’ complete.
SUCCESS: Creation of DNS record in Domain ‘example.org’ complete.Note: Additional information about the
dns.exe
utility and its syntax can be found here.
-
-
To apply server-wide DNS templates to several existing domains:
-
Save a list of domains and their IP addresses to the
domains_ip.txt
text file:C:> plesk db -N -e “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
Note: edit the
domains_ip.txt
file according to the requirements.To leave separate domains unchanged, remove them from the list.
-
Restore DNS records for all domains listed in the
domains_ip.txt
file to their DNS template values:Warning: All custom DNS records will be removed.
C:> for /f “tokens=1,2″ %a in (C:domains_ip.txt) do @”%plesk_cli%dns.exe” –reset %a -ip %b
SUCCESS: Restoring the DNS zone by the template for Domain ‘example.com’ complete.
SUCCESS: Restoring the DNS zone by the template for Domain ‘example.org’ complete.Note: Additional information about the
dns.exe
utility and its syntax can be found here.
-