Skip to content

Instantly share code, notes, and snippets.

@coolreader18
Created June 24, 2025 15:02
Show Gist options
  • Save coolreader18/6d5c4b70d0d0ebc9a97fbd866ff578df to your computer and use it in GitHub Desktop.
Save coolreader18/6d5c4b70d0d0ebc9a97fbd866ff578df to your computer and use it in GitHub Desktop.
Set the qBittorent incoming port to the port forwarded by PIA VPN
$Uri = "http://localhost:6969"
$piactl = 'C:\Program Files\Private Internet Access\piactl.exe'
& $piactl monitor portforward | ForEach-Object {
try {
$Port = [int]$_
} catch {
return
}
$Body = @{ json = ConvertTo-Json @{ listen_port = $Port } }
Invoke-WebRequest -Uri "$Uri/api/v2/app/setPreferences" -Method Post -Body $Body
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment