PowerShell for Windows Admins

Mar 4 2012   2:45PM GMT

Upload through BITS

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Downloading through BITS is easy as we have seen,  Uploading requites some work. First the BITS IIS extensions have to be loaded.  Restart IIS and look at the properties of the Virtual Directory being used for the transfer.  At the bottom you should find a BITS upload option in the Other section.  Double click and enable uploads.  Configure other properties as desired.

A single file upload can be achieved like this

Start-BitsTransfer -Source c:\source\transfer\testupload.txt -Destination http://webr201/transfer/testupload.txt -TransferType Upload

For multiple file uploads try this

Import-Module BitsTransfer -Force            
$computername = "WebR201"            
$source = "c:\source\transfer\"            
Get-ChildItem -Path $source |            
foreach {            
$destination =  "http://webr201/transfer/$($_.name)"            
Write-Host "Transferring $($_.Fullname) to $destination"            
Start-BitsTransfer -Source $($_.Fullname) -Destination $destination -TransferType Upload            

Import the module. Set the machine name & source folder. Run Get-ChildItem over the folder and for each file set up a BITS transfer source and destination variables using the name and fullname. Run the transfer.

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: