# install-innosetup.ps1 — robust silent install of Inno Setup 6 for the Windows runner. # Idempotent: exits 0 immediately if ISCC.exe is already present. $ErrorActionPreference = 'Stop' $candidates = @( "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe", "$env:ProgramFiles\Inno Setup 6\ISCC.exe" ) foreach ($c in $candidates) { if (Test-Path $c) { Write-Output "ISCC already present: $c"; exit 0 } } $url = 'https://jrsoftware.org/download.php/is.exe' $out = Join-Path $env:TEMP 'innosetup-installer.exe' Write-Output "Downloading Inno Setup: $url" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # -UseBasicParsing avoids the IE-engine dependency that fails under the SYSTEM account. Invoke-WebRequest -Uri $url -OutFile $out -UseBasicParsing $size = (Get-Item $out).Length Write-Output "Downloaded $size bytes" if ($size -lt 1000000) { throw "Downloaded file too small ($size bytes) - not a valid installer" } Write-Output "Installing silently..." $log = Join-Path $env:TEMP 'innosetup-install.log' $p = Start-Process -FilePath $out -ArgumentList '/VERYSILENT','/SUPPRESSMSGBOXES','/NORESTART','/SP-','/NOICONS',"/LOG=$log" -Wait -PassThru Write-Output "Installer exit code: $($p.ExitCode)" if ($p.ExitCode -ne 0) { Write-Output "----- install log tail -----" if (Test-Path $log) { Get-Content $log -Tail 40 | ForEach-Object { Write-Output $_ } } throw "Inno Setup installer failed with exit code $($p.ExitCode)" } foreach ($c in $candidates) { if (Test-Path $c) { Write-Output "ISCC installed: $c"; exit 0 } } throw "ISCC not found after install (looked in: $($candidates -join ', '))"