Replace web request with BITS transfer for ESD downloads

Switches from using Invoke-WebRequest to Start-BitsTransferWithRetry for downloading Windows ESD files. This provides better reliability and automatic retry handling for large file downloads.

Also removes trailing blank lines for cleaner formatting.
This commit is contained in:
rbalsleyMSFT
2025-11-29 18:44:34 -08:00
parent 8d84137a27
commit 7948201e18
+1 -3
View File
@@ -2023,7 +2023,7 @@ function Get-WindowsESD {
$OriginalVerbosePreference = $VerbosePreference
$VerbosePreference = 'SilentlyContinue'
Mark-DownloadInProgress -FFUDevelopmentPath $FFUDevelopmentPath -TargetPath $esdFilePath
Invoke-WebRequest -Uri $file.FilePath -OutFile $esdFilePath -Headers $Headers -UserAgent $UserAgent
Start-BitsTransferWithRetry -Source $file.FilePath -Destination $esdFilePath
Clear-DownloadInProgress -FFUDevelopmentPath $FFUDevelopmentPath -TargetPath $esdFilePath
$VerbosePreference = $OriginalVerbosePreference
WriteLog "Download succeeded"
@@ -2037,8 +2037,6 @@ function Get-WindowsESD {
}
}
function Get-ODTURL {
try {
[String]$ODTPage = Invoke-WebRequest 'https://www.microsoft.com/en-us/download/details.aspx?id=49117' -Headers $Headers -UserAgent $UserAgent -ErrorAction Stop