So, I have a dedicated server and the machine acts as a Hyper-V host. Only Remote Desktop is enabled on the box, for security, but the VMs have their own ports open (HTTP, SSH, etc). Transferring files between the Dedicated Server and my home network is a bit of a pain… one way is to open a port locally (SSH or FTP) and download the file from home to the dedicated box… bit of a pain, but it does work… But now i have found some magic in BITS Transfer!

Bits Transfer allows you to download and upload files in the back ground, intelligently… Hence the full name of Background Intelligent Transfer Service… So, how to you get this to work with Remote Desktop?

In the Remote Desktop Client, under the Local Resources Tab, under Devices and Resources, click the “More” option and select the drives you want to share out to your server. Remember, the server has access to these files… I am not sure if everyone on the server can see them, so be careful. Connect to your server and go into Computer… you should, by default, see your extra drives… they dont have real drive names though… So, what you need to do is go to the address \tsclient (should be always the same…) and you will see the drives you have shared. find the drive your interested in, find the exact file you want to copy over an Shift+Right click on the file. You will see an option to Copy As Path. Click this. Next, Open PowerShell (Should be installed on all servers, if not Google for it with Bing and find out how to install it. Once powershell is either opened or installed and opened, type “Import-Module bitstransfer”. now for the magic commands:

Start-BitsTransfer -source $sourceFile -destination $localtionFile
That is it… set $sourceFile to the URL of the file you want to download, and $locationFile to the place you want it placed. Powershell will show an progress bar of how the transfer is doing… But, what happens if the connection drops before the download finishes? Simple. Open your connection again, you should see your original powershell window. In here type:
Get-BitsTransfer | Resume-BitsTransfer
Now, this is looking for ALL bits transfers on the system, and then resuming them… You may want to check and see what Get-BitsTransfer shows as a result… In my case, i only want to start the jobs which are marked as having an error “TransientError” so my PowerShell Command is:
Get-BitsTransfer | Where-Object {$_.JobState -eq “TransientError” } | Resume-BitsTransfer
You could also use the Job ID if you have one (in my screen, its being truncated…)

So, What about downloading FROM the server to your local machine? Well, in the Start-BitsTransfer, swap the source and destination… Source is a local file on your server and destination is the fileshare on TSClient you want to upload to… and the resume upload and download will work to.

Another interesting option is to add the -Asynchronous option to the Start-BitsTransfer command. This will run the command fully in the background. there is aslo the option of using the -Suspend, which only adds the job, but does not start it immediately. In this case you can see some info about the download using the Get-BitsTransfer command. Finally, you need to run one final command: Complete-BitsTransfer. So, You would call
Get-BitsTransfer | Where-Object {$_.JobState -eq “Transferred” } | Complete-BitsTransfer
As the MeerKat says, Simples!

[UPDATED] Want to monitor the progress of the download? bitsadmin /monitor will show you the status of your transfer! Handy!