# Desk1 one-line install for Windows, Margin1 preselected: irm margin1.io/install | iex # # Downloads the current Desk1 Setup straight from desk1.io and runs it. A file fetched this way carries no # "downloaded from the internet" mark, so Windows doesn't hold it for the SmartScreen check or show the # "Windows protected your PC" prompt. It is the same installer the Download button gives you; its SHA-256 # is checked against desk1.io/download/latest.json before it runs. Nothing else is changed on your PC. # # Publisher: Brand Growth Advisory Pty Ltd (ABN 55 699 084 396), https://desk1.io. Licence: desk1.io/licences. $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 function Say([string]$t) { Write-Host " $t" } Write-Host '' Write-Host ' Desk1 installer (Margin1)' -ForegroundColor Cyan if ([Environment]::OSVersion.Version.Major -lt 10) { throw 'Desk1 apps need Windows 10 or 11.' } if (-not [Environment]::Is64BitOperatingSystem) { throw 'Desk1 apps need 64-bit Windows.' } # Smart App Control refuses every unsigned app with no override; say so instead of failing silently later. $sac = (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\CI\Policy' -Name VerifiedAndReputablePolicyState -ErrorAction SilentlyContinue).VerifiedAndReputablePolicyState if ($sac -eq 1) { Say 'Smart App Control is on for this PC. It only allows signed apps, and Desk1 Setup is not signed yet, so' Say 'it will refuse to run it. Turn Smart App Control off (Windows Security > App & browser control) or' Say 'wait for the signed build. Nothing was installed.' return } try { $latest = Invoke-RestMethod -Uri 'https://desk1.io/download/latest.json' -UseBasicParsing } catch { Say 'The installer list is being updated right now. Download Desk1 Setup from https://desk1.io/margin1/download instead.' return } $dir = Join-Path $env:TEMP ('desk1-install-' + [IO.Path]::GetRandomFileName().Replace('.', '')) New-Item -ItemType Directory -Path $dir | Out-Null $exe = Join-Path $dir 'Desk1-Setup.exe' Say "Downloading Desk1 Setup $($latest.version) ($([math]::Round($latest.size / 1MB, 1)) MB)..." Invoke-WebRequest -Uri $latest.url -OutFile $exe -UseBasicParsing # Belt and braces: strip the internet mark if the download tool added one. Unblock-File -Path $exe -ErrorAction SilentlyContinue $hash = (Get-FileHash -Path $exe -Algorithm SHA256).Hash.ToLowerInvariant() if ($hash -ne $latest.sha256.ToLowerInvariant()) { Remove-Item -Recurse -Force $dir -ErrorAction SilentlyContinue throw "The download didn't match its published checksum, so it was deleted. Try again, or download from https://desk1.io/margin1/download." } # The switches come from latest.json, so the installer's own build decides them. $args = @() if ($latest.silent) { $args += $latest.silent } if ($latest.preselect -and $latest.preselect.margin1) { $args += $latest.preselect.margin1 } Say 'Installing (for your Windows account only, no admin rights needed)...' $p = if ($args.Count) { Start-Process -FilePath $exe -ArgumentList $args -Wait -PassThru } else { Start-Process -FilePath $exe -Wait -PassThru } if ($p.ExitCode -ne 0) { throw "The installer stopped with code $($p.ExitCode)." } Remove-Item -Recurse -Force $dir -ErrorAction SilentlyContinue $app = Join-Path $env:LOCALAPPDATA 'Margin1\margin1.exe' if (Test-Path $app) { Say "Done. Margin1 $($latest.apps.margin1) is installed and in your Start menu." Say 'Every feature is free for 7 days; after that the everyday tools stay free. Opening it now.' Start-Process $app } else { Say 'Desk1 Setup finished. Open Margin1 from your Start menu, or download again from https://desk1.io/margin1/download.' } Write-Host ''