简体   繁体   中英

start download from website with powershell commandlet ( using BITS transfer)

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..:(

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM