$ErrorActionPreference = "Stop" $BaseUrl = "https://sitebrush.com/download/latest/server-app" $Dir = Join-Path $env:ProgramFiles "sitebrush" $Exe = Join-Path $Dir "sitebrush.exe" $Architecture = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString() switch ($Architecture) { "X64" { $BinaryArch = "amd64" } "Arm64" { $BinaryArch = "arm64" } default { throw "Unsupported CPU architecture: $Architecture" } } $Url = "$BaseUrl/sitebrush_windows_$BinaryArch.exe" Write-Host "SiteBrush installer" Write-Host "Detected Windows / $BinaryArch" Write-Host "Downloading $Url" New-Item -ItemType Directory -Force -Path $Dir | Out-Null Invoke-WebRequest -UseBasicParsing -Uri $Url -OutFile $Exe Write-Host "Installed: $Exe" & $Exe -install