This project is read-only.

Sample Powershell Scripts

These are Powershell scripts that utilize the API. Make sure you read the Requirements and Gotchas page--it is important.

Remove Torrents After Download Finishes

Save the following code as Remove-Torrent.ps1. Then in uTorrent, go to preferences, click on Advanced->Run Program and add the following line to the textbox below "Run this program when a torrent changes state":

powershell -File C:\Path\To\Scripts\Remove-Torrent.ps1 %I %S

$finishedStatuses = 4,5,7,8,11

if ($finishedStatuses -contains $args[1])
    $utorrentdll = Join-Path (Split-Path $MyInvocation.MyCommand.Path) 'UTorrentAPI.dll'
    [Reflection.Assembly]::LoadFile($utorrentdll) | Out-Null

    $utorrentclient = New-Object -TypeName UTorrentAPI.UTorrentClient -ArgumentList "http://mymachine:port/gui","utorrentuser","password"

Last edited Mar 29, 2012 at 9:42 PM by mikdav, version 7


Ameybanaye Feb 16, 2015 at 3:01 PM 
What does gui stand for ?

khaffner Jan 16, 2014 at 8:27 PM 
I tried the code above, with little luck. I got it to work by simplifying it. First of all, my uTorrent runs it when a download is complete. Instead of status change.

$utorrentdll = "C:\......\UTorrentAPI.dll"
[Reflection.Assembly]::LoadFile($utorrentdll) | Out-Null

$utorrentclient = New-Object -TypeName UTorrentAPI.UTorrentClient -ArgumentList "http://computername:port/gui","utorrentuser","password"