# Define variables $url = "https://www.terminalworks.com/downloads/tsscan/TSScan_client.exe" $outputDir = "$env:TEMP" $outputFile = Join-Path $outputDir "TSScan_client.exe" $ProgressPreference = 'SilentlyContinue' # 1. Download the installer Write-Host "Downloading TSScan client..." -ForegroundColor Cyan Invoke-WebRequest -Uri $url -OutFile $outputFile # 2. Run the installer silently Write-Host "Installing TSScan client silently..." -ForegroundColor Cyan # Inno Setup switches: # /VERYSILENT - Hides the installation wizard entirely # /SUPPRESSMSGBOXES - Prevents prompt dialogs from blocking the script # /NORESTART - Prevents automatic reboots $processArgs = "/SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART" $process = Start-Process -FilePath $outputFile -ArgumentList $processArgs -Wait -PassThru # 3. Check exit code and clean up if ($process.ExitCode -eq 0) { Write-Host "TSScan client installed successfully." -ForegroundColor Green } else { Write-Warning "Installation finished with exit code: $($process.ExitCode)" } # Remove the installer file from temp if (Test-Path $outputFile) { Remove-Item $outputFile -Force Write-Host "Cleaned up installer file." -ForegroundColor Cyan }