0

I have configured IIS server, where its running on localhost for now. i need to download files present in the IIS directory with help of Powershell commandlet.

i tried Background intelligent transfer service.. like

Start-BitsTransfer -Asynchronous -Priority High -TransferType Download -Source http://localhost/vdir/validity.txt -Destination C:\

it executed fine without giving any error but files are not downloading like m getting bits transfer status as "TRANSFERRED" but file is not getting downloaded.. any idea why is it so..:(

Kaustubh_Kharche
  • 725
  • 3
  • 13
  • 34

1 Answers1

1

Probably because -Asynchronous flag requires Complete-BitsTransfer cmdlet to complete transfer.

For example. If you will run your code like

Start-BitsTransfer -Asynchronous -Priority High -TransferType Download -Source http://localhost/vdir/validity.txt -Destination C:\

Then I guess you will have some xxxx.tmp file on your C:\ root. And when status of your BITS job will be like

JobId               : **3bdb9071-d780-446f-974c-074a48206c0c**
DisplayName         : BITS Transfer
TransferType        : Download
JobState            : **Transferred**
OwnerAccount        : blablabla
Priority            : High
FilesTransferred    : 1
FilesTotal          : 1
BytesTransferred    : 310764
BytesTotal          : 310764
CreationTime        : 2/23/2015 3:55:23 PM
ModificationTime    : 2/23/2015 3:55:39 PM
MinimumRetryDelay   : 
NoProgressTimeout   : 
TransientErrorCount : 0
ProxyUsage          : SystemDefault
ProxyList           : 
ProxyBypassList     : 

Then you will need to run following command to get xxxx.tmp file converted to validity.txt

$Job = Get-BitsTransfer -JobId "3bdb9071-d780-446f-974c-074a48206c0c"
Complete-BitsTransfer -BitsJob $Job
Andrii Matus
  • 166
  • 4
  • is there any advantage of using asynchronous BITS transfer?? – Kaustubh_Kharche Feb 24 '15 at 14:40
  • Yes. In asynchronous mode transfer will be automatically resumed in case of network failure or something. Actually, asynchronous mode means that transfer will be added as background job. Synchronous mode is something like usual manual copy operation. – Andrii Matus Feb 25 '15 at 08:48