Try fixing non-functioning scripts

This commit is contained in:
Manuel Thalmann 2023-07-15 12:21:38 +02:00
parent cfd7c17fc7
commit 60d9691f45

View file

@ -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;
}