21 lines
789 B
PowerShell
21 lines
789 B
PowerShell
Import-Module BitsTransfer
|
|
$deadline = (Get-Date).AddMinutes(50)
|
|
while ((Get-Date) -lt $deadline) {
|
|
$j = Get-BitsTransfer -Name 'Win11ARM64ISO' -ErrorAction SilentlyContinue
|
|
if (-not $j) { 'JOB GONE'; break }
|
|
if ($j.JobState -eq 'Transferred') {
|
|
Complete-BitsTransfer -BitsJob $j
|
|
Start-Sleep -Seconds 3
|
|
$f = Get-Item 'C:\Users\howar\Desktop\Win11_25H2_English_Arm64_v2.iso'
|
|
'DONE size=' + $f.Length
|
|
break
|
|
}
|
|
if ($j.JobState -in 'Error','TransientError') {
|
|
'STATE=' + $j.JobState + ' :: ' + $j.ErrorDescription
|
|
if ($j.JobState -eq 'Error') { break }
|
|
}
|
|
Start-Sleep -Seconds 30
|
|
}
|
|
$j = Get-BitsTransfer -Name 'Win11ARM64ISO' -ErrorAction SilentlyContinue
|
|
if ($j) { 'FINAL state=' + $j.JobState + ' bytes=' + $j.BytesTransferred + '/' + $j.BytesTotal }
|