Windows 10 Anniversary Update Brings Remoting Support for BITS

In this article we will look at a new feature in the BITS service which is included in Windows. Some background:

Background Intelligent Transfer Service (BITS) transfers files (downloads or uploads) between a client and server and provides progress information related to the transfers. You can also download files from a peer.

Use cases

  • Asynchronously transfer files in the foreground or background.
  • Preserve the responsiveness of other network applications.
  • Automatically resume file transfers after network disconnects and computer restarts.

Source: Microsoft

Possibly the most known service to leverage BITS is Windows Update, which even though it is downloading large amounts of data, rarely impacts the productivity of users since it is running asynchronous downloads in the background.

Introduced in Windows 7, the BitsTransfer PowerShell module contains several cmdlets for administering the BITS client:

This means we can leverage the benefits of BITS from PowerShell, as an alternative to using, for example, Invoke-WebRequest.

Previously, using cmdlets in the BITS module was not supported when invoked via PowerShell remoting. Let’s verify this on Windows 10 build 1511:

1
2
3
4
Invoke-Command -ComputerName CLIENT-JR-02 -ScriptBlock {
  Write-Output "Testing remote BITS on PowerShell version $($PSVersionTable.PSVersion.ToString())"
    Start-BitsTransfer -Source 'https://github.com/janegilring/PSVersion/archive/master.zip' -Destination $env:TEMP -Asynchronous
}

We got an error message stating “The remote use of BITS is not supported. For more information about BITS, see the MSDN documentation at http://go.microsoft.com/FWLINK/?LinkId=140888.

There is also a Microsoft Connect item logged regarding this issue.

Now, let’s try the same thing against a Windows 10 computer running Windows 10 Anniversary Update:

This is good news, as BITS via PowerShell remoting is now supported in PowerShell 5.1. Most likely this will also be supported in Windows Server 2016, which will be released at the Microsoft Ignite conference at the end of September.

You can find additional details and examples in this article on MSDN.

As stated in the article, A BITS Job created from a Remote PowerShell session runs under that session’s user account context and will only make progress when there is at least one active local logon session or Remote PowerShell session associated with that user account. Therefore, we would need to add -InDisconnectedSession to Invoke-Command in our example above for it to work properly. Alternatively we could have entered an interactive session using Enter-PSSession or setup a new PowerShell session using New-PSSession beforehand to run the BITS job in.

Share on: