uTorrent finished script

uTorrent finished script

1 min read - 28 Jan, 2026

This a uTorrent script that you can run to remove completed torrents after 30 minutes using uTorrent 3.6:

Run this program when torrent finishes:

powershell.exe -ExecutionPolicy Bypass -File U:\Scripts\remove_finished.ps1

# powershell.exe -ExecutionPolicy Bypass -File U:\Scripts\remove_finished.ps1

$baseUrl = "http://localhost:8080/gui"
$username = "admin"
$password = "admin"

$minAgeMinutes = 30

$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$pair = "$username`:$password"
$bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
$session.Headers["Authorization"] = "Basic " + [Convert]::ToBase64String($bytes)

# Get token
$tokenPage = Invoke-WebRequest "$baseUrl/token.html" -WebSession $session -UseBasicParsing
$token = ($tokenPage.Content -replace '<[^>]+>', '').Trim()

# Get torrent list
$response = Invoke-RestMethod "$baseUrl/?list=1&token=$token" -WebSession $session

$now = [DateTimeOffset]::UtcNow.ToUnixTimeSeconds()

foreach ($torrent in $response.torrents) {
    $hash = $torrent[0]
    $name = $torrent[2]
    $progress = $torrent[4]       # 1000 = finished
    $finishedAt = $torrent[24]    # Unix timestamp

    if ($progress -eq 1000 -and $finishedAt -gt 0) {
        $ageMinutes = ($now - $finishedAt) / 60

        if ($ageMinutes -ge $minAgeMinutes) {
            Invoke-WebRequest `
                "$baseUrl/?action=removedata&hash=$hash&token=$token" `
                -WebSession $session `
                -UseBasicParsing

            Write-Output "Deleted after Radarr window: $name"
        }
        else {
            Write-Output "Waiting for Radarr import ($([int]$ageMinutes)/$minAgeMinutes min): $name"
        }
    }
}

Write-Output "Done."

 

Hyperoptic Banner
utorrentscriptsradarr
This a uTorrent script that you can run to remove completed torrents after 30 minutes using uTorrent 3.6
Published Wednesday, 28 January 2026