How to get list of domains and their IP addresses in one query?

Created:

2016-11-16 12:59:19 UTC

Modified:

2017-08-08 13:41:50 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to get list of domains and their IP addresses in one query?

Applicable to:

  • Plesk for Windows

For Linux version of KB see this article .

Symptoms

How to get list of domains and their IP addresses in one query?

Resolution

To get all domains and their IP addresses use Plesk dbclient.exe utility:

Run the query below:

>"%plesk_bin%\\dbclient.exe" --direct-sql --sql="SELECT dom.id, dom.name, ia.ipAddressId, iad.ip_address FROM domains dom LEFT JOIN DomainServices d ON (dom.id = d.dom_id AND d.type = 'web') LEFT JOIN IpAddressesCollections ia ON ia.ipCollectionId = d.ipCollectionId LEFT JOIN IP_Addresses iad ON iad.id = ia.ipAddressId;"

You will get the result as below:

+----+-------------------------------+-------------+------------+
| id | name | ipAddressId | ip_address |
+----+-------------------------------+-------------+------------+
| 21 | domain1.tld | 2 | 10.0.0.1 |
| 36 | domain2.tld | 2 | 10.0.0.1 |
| 38 | domain3.tld | 2 | 10.0.0.1 |
| 26 | domain4.tld | 2 | 10.0.0.1 |
+------------------------------------+-------------+------------+
Have more questions? Submit a request
Please sign in to leave a comment.