plesk bin init_conf --init -hostname-not-required -license_agreed true -admin_info_not_required true -email 'user@example.com'
Unpack a zip-archive using PowerShell
Add-Type -Assembly "System.IO.Compression.FileSystem" [System.IO.Compression.ZipFile]::ExtractToDirectory(($pwd).path + "archive.zip", ($pwd).path)
Connecting to FTP using TLS without a certificate check
lftp -e 'debug 10;set ftp:passive-mode on; set ssl:verify-certificate no; set ssl-allow true; ls; bye;' -u user,passwd ftp://example.com/
Run command remotely over Windows RPC
$credentials = Get-Credential $server = "192.0.0.1" Invoke-WmiMethod -Path Win32_Process -ComputerName $server -name Create -Credential $credentials -ArgumentList "cmd /c remote_command.exe"
List packages, maintained by Plesk
- On
.deb
-based OS:dpkg-query -f='${Package} ${Maintainer}\n' -W | grep Plesk | cut -d' ' -f1
- On
.rpm
-based OS:yum list installed | grep -i '@plesk' | cut -d' ' -f1 | sed '/^$/d'
Retrieve unused IP addresses in Plesk via CLI
Retrieve a list of domains and their IP addresses:
plesk db "SELECT d.name, IF(ip.public_ip_address IS NULL, ip.IP_Address, ip.public_ip_address) AS 'IP' FROM domains d JOIN DomainServices ds ON d.id=ds.dom_id JOIN IpAddressesCollections ipc USING(ipCollectionId) JOIN IP_Addresses ip ON ipc.ipAddressId=ip.id WHERE ds.type='web';"
Retrieve unused IP addresses in Plesk via CLI:
plesk bin ipmanage -l | awk '{ if ($4 == 0 && $5 == 0) { print } }'
Run Plesk API request from CLI
curl -kLi -H "Content-Type: text/xml" -H "HTTP_AUTH_LOGIN: admin" -H "HTTP_AUTH_PASSWD:verysecurepwd" -H "HTTP_PRETTY_PRINT: TRUE" -d @payload.xml https://plesk.example.com:8443/enterprise/control/agent.php
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} $request = New-Object System.Net.WebClient $request.Headers.add('HTTP_AUTH_LOGIN','admin') $request.Headers.add('HTTP_AUTH_PASSWD','verysecurepwd') $request.Headers.add('HTTP_PRETTY_PRINT','true') $response = $request.UploadFile('https://plesk.example.com:8443/enterprise/control/agent.php','.\payload.xml') [System.Text.Encoding]::ASCII.GetString($response)
Dump Postfix database contents to the stdout
Here virtual is the name of the virtual.db
postmap -s /var/spool/postfix/plesk/virtual
Add your IP to the allowed in “Restrict administrative access” list
plesk db "INSERT INTO cp_access (type, netaddr, netmask) VALUES ('deny','10.10.10.1','255.255.252.0');"
Load updates from the developer repositories
echo "10.52.3.135 autoinstall.plesk.com" >> /etc/hosts