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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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: