Running uTorrent as a service on Windows
So I have recently set up my own Windows Server 2012 box to replace my old NAS. There was nothing wrong with the old box particularly, I just wanted a bit more control over it all, and I wanted to be able to run Plex, which the old box just wasn’t powerful enough to handle. One of the features of the NAS box was that it has a BitTorrent client, accessible via a web browser, and I was keen to replicate this functionality on my new set up.
The popular µTorrent client seemed like a good solution, as it includes a web-based user interface out of the box. Unfortunately, there is no built-in way to get it to run without being actually logged into the server at the time. The usual trick of setting up a scheduled task to run at start up unfortunately didn’t seem to work, and all of the guidance I could find on the internet suggested that I use the Windows Server 2003 Resource Kit to create a service, which unfortunately seems to be incompatible with Windows Server 2012!
So, in the end I gave in and came up with my own solution, and I thought I would write about it here in case it is of any use to anyone else trying to achieve the same thing.
First things first – I had to get the µTorrent client working on my server. I created a user account just for this purpose, logged in with it, and ran through the set up procedure. Once it was installed, I opened the client and configured it to my liking, making sure to enable the web UI option!
Secondly, I fired up Visual Studio 2012 and built a very small service executable that simply runs the client for me. You can grab the source code on GitHub, or if you’re not much of a coder, you can download a compiled version of this executable here.
I copied the compiled executable to my server, placed it in the same directory as the µTorrent client (type “%AppData%\uTorrent” into the address bar), and installed it using the following command line (you will need an elevated Command Prompt – right click and Run as Administrator):
SC CREATE uTorrent binPath= C:\Wherever\You\Copied\uTorrentService.exe start= delayed-auto obj= .\YourServiceAccount password= Password
Once installed, I could then simply start the new uTorrent service from the Services control panel, and hey presto, everything was working!
Just make sure you have .NET 4.5 installed in the machine if you are using the above source code.
This works perfectly, thank you!
Awesome. Thanks very much
Thanks for article and code, it works great.
Thanks.Working perfect.i am using for WebUi
This doesn’t work correctly because “%AppData%\uTorrent” is not where the uTorrent executable gets installed it’s where the it stores its data. The uTorrent client is installed in “C:\Program Files (x86)\uTorrent”.
I have no idea how others got this to work unless they changed the source code and recompiled or moved the uTorrent exe into “%AppData%\uTorrent”.
It certainly used to install to %AppData% when I wrote this post. It’s possible they may have changed it to install to the correct place since.
Strangely there is a copy(?) of the exe in the “%AppData%\uTorrent” folder. Assuming that exe works, the service won’t start on my system for some other reason. I’m continuing to debug this.
what should I be using for “.\YourServiceAccount”? Various parameters I’ve tried are not working including account name with administrator priviledges and “Local System” which matches most other services
Any local computer account that you want the service to run as, for example you can specify your own account name and password.
I’m really messing up your comment thread formatting here 🙂
I’m getting the following error when starting the service:
Windows could not start the uTorrent service on Local Computer.
Error 1069: The service did not start due to a logon failure.
The service shows “Log On As” is set to “.\[username]”
OK, I’m suffering from a Windows 10 thing: I went into properties for the service and changed the username to “[machine name]\[username]” and now it works!
Unfortunately it puts uTorrent into the background without any foreground GUI which is not ideal for me.
Thanks for your help!
I ended up using AlwaysUp to create the utorrent as a service. Then in the options of AlwaysUP while creating the service there is a section to run as xyz user. So just add your username and password and presto.
This works great, but it if you’re storing your downloads on a SMB share, it will result in the torrents having a error status of “Error: Volume not mounted”. To fix this you need to specify the download location as a UNC path rather than a drive letter. Old torrents will still give the error until you remove and readd them.
You are a legend!