diff --git a/scripts/Windows/Scripts/SoftwarePackage.ps1 b/scripts/Windows/Scripts/SoftwarePackage.ps1 index 3dac0bcf..55f08e01 100644 --- a/scripts/Windows/Scripts/SoftwarePackage.ps1 +++ b/scripts/Windows/Scripts/SoftwarePackage.ps1 @@ -7,12 +7,11 @@ function Install-SoftwarePackage([Context] $context, [string] $location, [string if (-not ($local.IsPresent)) { $tempDir = $context.GetTempDirectory(); - $request = [System.Net.WebRequest]::Create($location); - $request.AllowAutoRedirect = $false; - $response = $request.GetResponse(); - $fileName = [System.IO.Path]::GetFileName($response.GetResponseHeader("Location")); + $response = Invoke-WebRequest $location; + $fileName = [System.IO.Path]::GetFileName($response.Headers["Location"]); $filePath = Join-Path $tempDir $fileName; + Invoke-WebRequest $location $filePath; } else { $filePath = $location; }