From 6706fe68a5ef18d3a91aa69a10ea35b4bc9a0a43 Mon Sep 17 00:00:00 2001 From: Bernard Budde <11386613+baidarka@users.noreply.github.com> Date: Fri, 13 Dec 2024 08:27:29 +0000 Subject: [PATCH] replace WebClient with Invoke-WebRequest --- images/macos/scripts/helpers/Common.Helpers.psm1 | 2 +- images/ubuntu/scripts/helpers/Common.Helpers.psm1 | 2 +- images/windows/scripts/helpers/InstallHelpers.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/images/macos/scripts/helpers/Common.Helpers.psm1 b/images/macos/scripts/helpers/Common.Helpers.psm1 index 359f5974ee32..57e84aa09ea5 100644 --- a/images/macos/scripts/helpers/Common.Helpers.psm1 +++ b/images/macos/scripts/helpers/Common.Helpers.psm1 @@ -84,7 +84,7 @@ function Invoke-DownloadWithRetry { for ($retries = 20; $retries -gt 0; $retries--) { try { $attemptStartTime = Get-Date - (New-Object System.Net.WebClient).DownloadFile($Url, $Path) + Invoke-WebRequest -Uri $Url -Outfile $Path $attemptSeconds = [math]::Round(($(Get-Date) - $attemptStartTime).TotalSeconds, 2) Write-Host "Package downloaded in $attemptSeconds seconds" break diff --git a/images/ubuntu/scripts/helpers/Common.Helpers.psm1 b/images/ubuntu/scripts/helpers/Common.Helpers.psm1 index 75dcdb7457f7..0fef1e3a164b 100644 --- a/images/ubuntu/scripts/helpers/Common.Helpers.psm1 +++ b/images/ubuntu/scripts/helpers/Common.Helpers.psm1 @@ -133,7 +133,7 @@ function Invoke-DownloadWithRetry { for ($retries = 20; $retries -gt 0; $retries--) { try { $attemptStartTime = Get-Date - (New-Object System.Net.WebClient).DownloadFile($Url, $DestinationPath) + Invoke-WebRequest -Uri $Url -Outfile $DestinationPath $attemptSeconds = [math]::Round(($(Get-Date) - $attemptStartTime).TotalSeconds, 2) Write-Host "Package downloaded in $attemptSeconds seconds" break diff --git a/images/windows/scripts/helpers/InstallHelpers.ps1 b/images/windows/scripts/helpers/InstallHelpers.ps1 index 67faade1d2a5..396ad4d51e09 100644 --- a/images/windows/scripts/helpers/InstallHelpers.ps1 +++ b/images/windows/scripts/helpers/InstallHelpers.ps1 @@ -184,7 +184,7 @@ function Invoke-DownloadWithRetry { for ($retries = 20; $retries -gt 0; $retries--) { try { $attemptStartTime = Get-Date - (New-Object System.Net.WebClient).DownloadFile($Url, $Path) + Invoke-WebRequest -Uri $Url -Outfile $Path $attemptSeconds = [math]::Round(($(Get-Date) - $attemptStartTime).TotalSeconds, 2) Write-Host "Package downloaded in $attemptSeconds seconds" break