# Install p8 (https://8intuition.com) on Windows with one PowerShell command: # # irm https://8intuition.com/install.ps1 | iex # # What this script does - it is short, read it first if you like: # 1. Picks the p8 build for this PC: Windows 10 / 11 on x64, or Windows 11 on Arm. # 2. Downloads the installer over HTTPS from download.8intuition.com (the same file as the # Download button) and checks that it is the p8 installer. # 3. Runs it silently. p8 installs for your user only (into %LOCALAPPDATA%\p8, with a Start menu # entry): no admin rights, no UAC prompt. An open p8 is asked to quit first. # 4. Opens p8. # Nothing else on your PC is changed. Your boards and settings stay. # # Options (set them before the command, e.g. `$env:P8_NO_OPEN = 1; irm https://8intuition.com/install.ps1 | iex`): # P8_NO_OPEN=1 do not open p8 when the install is done # # Uninstall: Settings > Apps > Installed apps > p8 > Uninstall. & { # Everything runs inside this block, so a download cut off halfway runs nothing; `return`, never # `exit` (that would close the PowerShell window the command was pasted into). $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' # Windows PowerShell downloads far faster without the progress bar try { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 } catch { } $base = if ($env:P8_INSTALL_BASE) { $env:P8_INSTALL_BASE.TrimEnd('/') } else { 'https://account.8intuition.com' } $site = 'https://8intuition.com' $tmp = $null function Step([string]$text) { Write-Host ' -> ' -ForegroundColor Cyan -NoNewline; Write-Host $text } function Note([string]$text) { Write-Host " $text" -ForegroundColor DarkGray } function Fail([string]$text) { Write-Host '' Write-Host ' x ' -ForegroundColor Red -NoNewline Write-Host $text Write-Host '' throw 'p8-install-stopped' } # Where /dl/p8/ leads (a HEAD request, not counted as a download). A platform without a # build leads to the site's download page instead of an installer. function Resolve-Build([string]$key, [string]$agent) { try { $r = Invoke-WebRequest -Uri "$base/dl/p8/$key" -Method Head -UseBasicParsing -MaximumRedirection 10 -UserAgent $agent if ($r.BaseResponse.ResponseUri) { return $r.BaseResponse.ResponseUri.AbsoluteUri } return $r.BaseResponse.RequestMessage.RequestUri.AbsoluteUri } catch { Fail 'Could not reach 8intuition.com. Check your connection and run the command again.' } } Write-Host '' Write-Host ' p8' -ForegroundColor Cyan -NoNewline Write-Host ' installer' -NoNewline Write-Host ' - 8intuition.com' -ForegroundColor DarkGray Write-Host '' try { if ([Environment]::OSVersion.Platform -ne 'Win32NT') { Fail "This is the Windows installer. On macOS or Linux run: curl -fsSL $site/install.sh | sh" } $build = [Environment]::OSVersion.Version.Build if ($build -lt 17763) { Fail "p8 needs Windows 10 (version 1809 or later) or Windows 11. This PC has build $build." } if (-not [Environment]::Is64BitOperatingSystem) { Fail 'p8 needs 64-bit Windows.' } # The machine's own CPU: an x64 PowerShell on a Windows on Arm PC reports AMD64 for itself. $arch = (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -ErrorAction SilentlyContinue).PROCESSOR_ARCHITECTURE if (-not $arch) { $arch = $env:PROCESSOR_ARCHITECTURE } $key = 'win-x64'; $kind = 'x64' if ($arch -eq 'ARM64') { $key = 'win-arm64'; $kind = 'Arm' } $agent = "p8-install/1 (Windows $build $arch)" $url = Resolve-Build $key $agent if ($url -notmatch '\.exe$' -and $key -eq 'win-arm64') { # No Arm build right now: the x64 one runs on Windows 11 on Arm too. $key = 'win-x64'; $kind = 'x64, emulated on Arm' $url = Resolve-Build $key $agent } if ($url -notmatch '\.exe$') { Fail "No p8 build for Windows right now. See $site/p8/download" } $tmp = Join-Path ([IO.Path]::GetTempPath()) ('p8-install-' + [Guid]::NewGuid().ToString('N').Substring(0, 8)) New-Item -ItemType Directory -Path $tmp | Out-Null $setup = Join-Path $tmp 'p8-setup.exe' Step "Downloading p8 for Windows ($kind)" try { Invoke-WebRequest -Uri "$base/dl/p8/$key" -OutFile $setup -UseBasicParsing -MaximumRedirection 10 -UserAgent $agent } catch { Fail "The download failed. Check your connection and run the command again, or download p8 from $site/p8/download" } Step 'Checking the installer' $info = (Get-Item $setup).VersionInfo $bytes = [IO.File]::ReadAllBytes($setup) if ($bytes.Length -lt 1MB -or $bytes[0] -ne 0x4D -or $bytes[1] -ne 0x5A -or $info.ProductName -ne 'p8') { Fail 'The downloaded file is not the p8 installer. Nothing was installed. Run the command again.' } $version = $info.ProductVersion $dir = Join-Path $env:LOCALAPPDATA 'p8' $exe = Join-Path $dir 'p8-desktop.exe' $old = $null if (Test-Path $exe) { $old = (Get-Item $exe).VersionInfo.ProductVersion } $open = @(Get-Process p8-desktop -ErrorAction SilentlyContinue) if ($open.Count -gt 0) { Step 'Quitting the open p8 so it can be updated' foreach ($p in $open) { [void]$p.CloseMainWindow() } $deadline = (Get-Date).AddSeconds(30) while ((Get-Process p8-desktop -ErrorAction SilentlyContinue) -and (Get-Date) -lt $deadline) { Start-Sleep -Milliseconds 500 } if (Get-Process p8-desktop -ErrorAction SilentlyContinue) { Fail 'p8 is still open (it may be asking you something). Quit p8 (its menu > Quit), then run the command again.' } } Step "Installing p8 $version for your user" # Downloaded here, the installer carries no internet mark, so SmartScreen does not stop it. $run = Start-Process -FilePath $setup -ArgumentList '/S' -Wait -PassThru if ($run.ExitCode -ne 0 -or -not (Test-Path $exe)) { Fail "The installer stopped (exit code $($run.ExitCode)). Nothing else was changed. Download p8 from $site/p8/download, or tell us: 1@8intuition.com" } Write-Host '' Write-Host ' OK ' -ForegroundColor Green -NoNewline Write-Host "p8 $version is installed" -NoNewline if ($old -and $old -ne $version) { Write-Host " (was $old)" -ForegroundColor DarkGray } else { Write-Host '' } Note 'It is in the Start menu. p8 updates itself from now on.' if (-not $old) { Note 'Your 10-day free trial starts when p8 opens. No card, no account.' } Note 'Bought a license? Click "Open p8" in your welcome email, or paste your key in p8.' if (-not $env:P8_NO_OPEN) { Start-Process -FilePath $exe Note 'Opening p8...' } Write-Host '' } catch { if ("$_" -ne 'p8-install-stopped') { Write-Host '' Write-Host ' x ' -ForegroundColor Red -NoNewline Write-Host "Something went wrong: $_" Write-Host " Download p8 from $site/p8/download, or tell us: 1@8intuition.com" -ForegroundColor DarkGray Write-Host '' } } finally { if ($tmp -and (Test-Path $tmp)) { Remove-Item -Recurse -Force $tmp -ErrorAction SilentlyContinue } } }