BITS Transfer is not allowed in Remote PowerShell

I’ve been developing scripts for quite some time now. One of the more popular have been my script to download TechEd/MMS event videos and powerpoint slides. During the development of that script I went with the .Net Framework WebClient feature instead of the PowerShell integrated BITS transfer feature to some peoples questions/complaints(?).

Today I for once thought that I might just as well use the beloved BITS transfer in PowerShell while developing a script. But it didn’t work. So know I have an additional reason on why to use the WebClient feature instead of BITS :) Not sure that is a thing to be happy about but you get the idea.

The problem occur when you try to run a script, or a scriptblock, in a remote PowerShell session. BITS are NOT allowed to be executed in a remote PowerShell session. Never. Ever.

dont_use_bits_in_remote_powershell_session

You get the error message “The remote use of BITS is not supported” when you try.

What you have to do instead is to use the “New-Object System.Net.WebClient” command and put that into a variable that then can use the DownloadFile method.

You could also vote for a change in the product at Microsoft Connect.

 

/Tim

About The Author

Tim Nilimaa is a consultant with Lumagate in Sweden. He has been working with Configuration Manager for 8 years. His knowledge has been selected as a speaker at many events among them Microsoft Management Summit.

No Comments

Leave A Reply