I'm sorry to keep asking about Powershell, my script-foo is not what it needs to be.
I'm writing a BitsTransfer .PS1 to automate the weekly download of an ASCII file.
It never seems to complete and reach a status of "Transferred" and seems stalled in a "Transferring" state. I can see a TMP file in my -Destination folder, with my ASCII data in it.
When I manually download the target file and compare it to the TMP file, they're the same size and appear to have the same first and last records. I assume the download is done.
If I manually run Get-BitsTransfer | Complete-BitsTransfer, the TMP file disappears but still no -Destination file.
My script is nothing sophisticated...
$date= Get-Date -format yyMMdd
$ntispasswd = ConvertTo-SecureString "*******" -AsPlainText -Force
$ntiscreds = New-Object System.Management.Automation.PSCredential ("*******", $ntispasswd)
$jobdescriptor = "DMFWA" + $date
$dmfpath = "C:\DMF"
# -Source https://dmf.ntis.gov/dmldata/weekly/WA$date `
Import-Module BitsTransfer
Start-BitsTransfer `
-DisplayName $jobdescriptor `
-Priority High `
-ProxyUsage Override `
-ProxyList mckwebfilt1:3128 `
-RetryInterval 60 `
-TransferType Download `
-Source https://dmf.ntis.gov/dmldata/weekly/WA130322 `
-Destination $dmfpath\TestWA$date.txt `
-Authentication Basic `
-Credential $ntiscreds `
-Asynchronous
$job = Get-BitsTransfer $displayname
While($Job.Jobstate -ne 'Transferred'){
$job
Start-Sleep -s 1
}
Complete-BitsTransfer $job
Can anybody help me understand what I'm doing wrong?