# XYTH Studios Launcher: install it without the browser's "Windows protected your PC" warning. # # powershell -c "irm https://xythstudios.com/install.ps1 | iex" # # Paste that line into the Run box (Windows key + R) or into a terminal. This script: # 1. reads the current launcher version, size and SHA-256 from the studio's catalogue on dl.xythstudios.com; # 2. downloads that installer and checks its size and SHA-256, and runs nothing if either is wrong; # 3. installs it for your Windows account only (no admin rights) and opens the launcher. # Windows SmartScreen only checks programs that a browser downloaded. A download made by PowerShell carries no such # mark, so the installer runs without that warning. Windows Security still scans it as usual. # From then on, the launcher checks everything it installs against the studio's signed catalogue. # About the launcher: https://xythstudios.com/launcher/ & { $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' # Windows PowerShell's progress bar slows downloads to a crawl try { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 } catch { } $setup = $null try { Write-Host '' Write-Host 'XYTH Studios Launcher' -ForegroundColor Cyan if (-not [Environment]::Is64BitOperatingSystem) { throw 'the launcher needs 64-bit Windows 10 or 11' } $l = (Invoke-RestMethod -UseBasicParsing -Uri 'https://dl.xythstudios.com/launcher/manifest.json').manifest.launcher if (-not $l -or "$($l.url)" -notmatch '^https://dl\.xythstudios\.com/launcher/[A-Za-z0-9._-]+\.exe$' -or "$($l.sha256)" -notmatch '^[0-9a-f]{64}$' -or "$($l.version)" -notmatch '^[0-9A-Za-z.+-]+$') { throw "the studio's catalogue doesn't list a launcher download right now" } $exe = Join-Path $env:LOCALAPPDATA 'XYTH Studios Launcher\xyth-launcher.exe' if ((Test-Path -LiteralPath $exe) -and (Get-Item -LiteralPath $exe).VersionInfo.ProductVersion -eq $l.version) { Write-Host "Version $($l.version) is already installed. Opening it." Start-Process -FilePath $exe return } $setup = Join-Path $env:TEMP ($l.url -split '/')[-1] Write-Host ('Downloading version {0} ({1:N1} MB)...' -f $l.version, ($l.size / 1MB)) Invoke-WebRequest -UseBasicParsing -Uri $l.url -OutFile $setup $size = (Get-Item -LiteralPath $setup).Length $hash = (Get-FileHash -Algorithm SHA256 -LiteralPath $setup -ErrorAction Stop).Hash.ToLowerInvariant() if ($size -ne [int64]$l.size -or $hash -ne $l.sha256) { throw "the download didn't match the catalogue ($size bytes, SHA-256 $hash), so nothing was installed" } Write-Host 'Checked. Installing for this Windows account...' # /P: passive (a progress bar, no questions). /R: open the launcher when it's done. # Wait for the installer only: Start-Process -Wait would also wait for the launcher it opens. $p = Start-Process -FilePath $setup -ArgumentList '/P', '/R' -PassThru $null = $p.Handle # keeps the exit code readable once the installer has exited $p.WaitForExit() if ($p.ExitCode -ne 0) { throw "the installer stopped (exit code $($p.ExitCode))" } Write-Host 'Done. The launcher is opening. Next time, start it from the Start menu or your desktop.' } catch { Write-Host '' $why = "$($_.Exception.Message)".Trim().TrimEnd('.') Write-Host "The install didn't finish: $why." -ForegroundColor Red if ($why -match 'virus|unwanted') { Write-Host 'Windows Security stopped the installer. Please tell us at dev@xythstudios.com and try again later.' } else { Write-Host 'You can also download the installer from https://xythstudios.com/launcher/' } Read-Host 'Press Enter to close' | Out-Null } finally { if ($setup -and (Test-Path -LiteralPath $setup)) { Remove-Item -LiteralPath $setup -Force -ErrorAction SilentlyContinue } } }