start /w msiexec /x {PRO-DU-C-T-CODE} /l*v C:\debug.log /qn REBOOT=R
Tag: Windows
List all scheduled tasks using PowerShell
Get-ScheduledTask -TaskPath "\" | % { $Task = "" | Select Task, Description, Enabled, Application, Arguments; $TaskInfo = [xml](Export-ScheduledTask $_); $Task.Task = $_.TaskName; $Task.Description = $_.Description; $Task.Enabled = $TaskInfo.Task.Settings.Enabled; $Task.Application = $TaskInfo.Task.Actions.Exec.Command; $Task.Arguments = $TaskInfo.Task.Actions.Exec.Arguments; $Task } | FL
Automatically rebind MySQL server to local/all interfaces
plesk sbin mysqlmng --bind-address local
plesk sbin mysqlmng --bind-address all
Bind and connect to TCP socket using PowerShell
- Bind
$Listener = [System.Net.Sockets.TcpListener]443 $Listener.Start() while($true) { $client = $Listener.AcceptTcpClient() Write-Host "Connection received!" $client.Close() }
- Connect
(New-Object Net.Sockets.TcpClient).Connect('192.0.2.1', 443)
Unpack a zip-archive using PowerShell
Add-Type -Assembly "System.IO.Compression.FileSystem" [System.IO.Compression.ZipFile]::ExtractToDirectory(($pwd).path + "archive.zip", ($pwd).path)
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"
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)
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');"
Install Plesk without micro-updates
./plesk-installer --select-release-id RELEASE --skip-patch
List of releases can be retrieved via:
./plesk-installer --show-releases