December 13, 2008 by sharky
A few readers have contacted us in regards to being throttled (or more specifically; sandvined) by their ISPs. As described in these instances, seeding is fine initially but then trickles down to under 10 KB/s. One solution that works well is a simple restart of µTorrent (with a random port number), which seems to temporarily unblock the connections. That is, until the sandvine hardware figures out the established new port number, and seeding winds down to a crawl once again. However, we can’t always be sitting in front of the computer, constantly monitoring the status of µTorrent’s upload speeds - this just isn’t practical. A better solution involves automated stopping & restarting of uTorrent.exe on a pre-determined schedule, each time with a randomized port.
NOTE: This tip can also be useful for Internet connections that often drop, in the event that µTorrent doe not automatically resume downloading or seeding again unless it is restarted.
Introduction: uTorrent Automatic Stop/Restart
In short, what we’re going to do here is create and schedule a task that forcefully stops (kills) µTorrent, and create a second task that restarts it a minute later - all for the sole purpose of changing the port number. The process is completely automated (and flexible), whereby it can be set to repeat every hour, 2 hours or for whatever timeframe is required.
For the life of us, we couldn’t figure out a way to stop µTorrent using XP/Vista’s built-in Task Scheduler utility on its own. A Google search for this came up blank; nor are there any available freeware/ shareware options that achieve this. Not to be stymied, we’ve come up with a free solution using WinXP/Vista’s taskkill feature, combined with Task Scheduler.
Step 1 - Turn on ‘Randomize port each start’ in µTorrent
First thing to do is enable "Randomize port each start" in µTorrent. In Preferences, click on the Connection tab, and put in a checkmark where applicable, see below:
Step 2 - Create a Taskkill batch file
As mentioned, Taskkill is a Vista/XP utility that ends any running task or process. We can create a batch file (*.bat) with a taskkill command, and then launch it to kill a specified process - in this case uTorrent.exe. To do this, create a new text document and open it with Notepad, and enter in these two lines:
@echo off
taskkill /im uTorrent.exe /f
Next, save and close the new (*.txt) document; and for example, call it "utorrent.txt" (this is arbitrary, but used for the rest of our examples). Now, rename the .txt extension to *.bat (so you now have a file called "utorrent.bat"). If you now run (double-click) utorrent.bat, you guessed it, it will automatically shut down µTorrent. For the sake of simplicity, save utorrent.bat to the root of your C: drive. Don’t feel like creating your own batch file? Download ours from here.
Step 3 - Running utorrent.bat from Task Scheduler
We want to run the batch file at a specific time, so for this we’ll use Task Scheduler. Go to Start Menu > All Programs > Accessories > System Tools > Scheduled Tasks and click on Add Scheduled Task.
In the Schedule Task Wizard, we need to point our new task to the utorrent.bat file. Click "Browse" and assuming your utorrent.bat file is located in the C:\ drive, find and select it.
Once found, click OPEN. On the next page of the wizard, add a name to the new task (we called it utorrent_kill), and select the DAILY radio button, and click Next, as shown below:
On the next screen you’ll be presented with some options, just click Next (we’ll come back to this). Again, another screen will appear where you can enter a password for the user (if logged into XP/Vista). It’s not necessary, just click Next. At the end of the wizard, put a checkmark in "Open advanced properties for this task…", and click FINISH. If you’re logged into your OS as a user (not admin) then you’ll likely get an error message. Ignore it. In the new task (i.e. utorrent_kill), put a checkmark in "Run only if logged on" - this is important. Click APPLY. Looking at our example below, the task properly points to our utorrent.bat file in C:\.
Next, click on the Schedule tab in your utorrent_kill task. It’s important to make a note of WHAT TIME the task starts (needed for when we add the second task to restart uTorrent.exe). You can change it, but just remember it, so make it something simple. For our example, we chose 6:00 PM. Now, click on the Advanced… button, and place a checkmark for "Repeat task". For the value "Every", change this to 2 hours (or however long a timeframe you’d wish for the interval between when uTorrent is to be stopped and restarted). For "Duration", we entered 1000 hours as to keep the task repeating for a long period of time (although this is probably overkill). When done, click OK, and then Apply.
Whew! The first part is done. In the example above, uTorrent will now be terminated every two hours each day, beginning at 6:00 PM.
Step 4 - Restarting utorrent.exe in Task Scheduler
Now that we’ve created a task that kills uTorrent, we’ll need to create a second task that restarts it. Again, go back to Task Scheduler > Add Scheduled Task. In the Schedule Task Wizard, you should see µTorrent listed, likely at the top of the list. Highlight (select) it, and click Next.
Again, give it an arbitrary name, or leave it as "µTorrent", and again select Daily. On the next screen, enter the start time as to be one minute ahead of from what you used in Step 3. In our example below, we chose 6:01 PM.
After setting up the job, change it to "Run only if logged on". Now, this is important: Your proper path to uTorrent.exe may or may not be shown correctly in the new job. To be sure that it’s correctly pointing to the executable, click Browse… and then point it to your uTorrent.exe file (the default path is C:\Program Files\uTorrent\uTorrent.exe).
Again, click on the Schedule tab, click Advanced… , checkmark "Repeat task" and enter in the same values from Step 3 (i.e. Every 2 hours; duration - 1000 hours).
Congrats! If both jobs are set up correctly, uTorrent will be closed every two hours and also restarted every 2 hours, with a 1 minute lag between jobs. In each instance that uTorrent is restarted, it will use a different port number. To test that your jobs are working correctly, you can right-click each one, and select RUN.
Just a Reminder…
— (Automated) stopping is not recommended if there are current active downloads in µTorrent (as torrents may need to be rechecked before they recommence downloading). Either use this tip for torrents that are seeding only, or be sure to stop your active downloads first.
— The one minute interval between jobs might be a little low, as we’d encountered one error (out of 50 seeding torrents) from a torrent from Karagarga (although we can’t confirm that this error, "Failure. Connection Limit Exceeded..") came from doing this or not. Adjust accordingly if you run into problems.