Monthly Archive



As someone who does a far amount of downloading of stuff – especially technical documents etc I was interested to see that cmdlets had been added to CTP 3 to enable file downloads using BITS.

The recent post from the PowerShell Team

made me want to try it out.  I also spotted the post about copying colourised scripts from PowerShell ISE - – and it has an attachment.  Ok I want that script and I can test out the file transfer stuff.

First up – the file transfer cmdlets can’t be found in PowerShell.  They are in a seperate module that you have to import using

Import-Module FileTransfer –Verbose

You can see the modules available in the PowerShell install directory. There is also one for PSDiagnostics.

Using the –verbose parameter you will see that PowerShell loads an assembly and the format data and then the cmdlets.

The URL of the file we want to download is

$file = ""

Many thanks for making that easy to find.  If you can’t find the URL you want try the technique outlined here -

New-FileTransfer -ServerFileName $file -ClientFileNamePrefix c:\scripts -ClientFileName

–DisplayName  DN1 –Asynchronous

Can be used to perform the download. Make sure you use the client file name prefix (path) and a file name as shown.  The display name identifies the download.  Using –Asynchronous is a good idea if the file is of any size as you cab get on with other things during the download.

To view the download progress we can use

Get-FileTransfer -Name DN1

We are looking for the JobState to change to Transferred. We can then use

$job = Get-FileTransfer -Name DN1
Complete-FileTransfer -BitsJob $job

To complete the process.

The full set of cmdlets for file transfers is


This simple test shows this functionality works and is easy to use.  This is definitely something I will be using more often.  I would recommend that if you are making files available for download you make the URL easy to find – lets get this functionality in use.


Technorati Tags: PowerShell,CTP3,File Transfer

Leave a Reply