$ErrorActionPreference = 'Stop' function Test-IsAdministrator { $identity = [Security.Principal.WindowsIdentity]::GetCurrent() $principal = New-Object Security.Principal.WindowsPrincipal($identity) return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) } function Restart-ElevatedIfNeeded { if (Test-IsAdministrator) { return } Write-Host 'Requesting administrator privileges...' -ForegroundColor Yellow $scriptText = $MyInvocation.MyCommand.Definition if ([string]::IsNullOrWhiteSpace($scriptText)) { throw 'Unable to relaunch this script with elevation.' } $encodedCommand = [Convert]::ToBase64String( [Text.Encoding]::Unicode.GetBytes($scriptText) ) Start-Process -FilePath 'powershell.exe' -Verb RunAs -ArgumentList @( '-NoProfile', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', $encodedCommand ) | Out-Null exit } function Invoke-RemoteScript { param( [Parameter(Mandatory = $true)] [string] $Url ) Write-Host "Running $Url" -ForegroundColor Cyan Invoke-RestMethod -Uri $Url | Invoke-Expression } function Show-RobotBanner { Write-Host ' .----. ' -ForegroundColor Cyan Write-Host ' _/ .--. \_ ' -ForegroundColor Cyan Write-Host ' /_ |[]| _\ ' -ForegroundColor Cyan Write-Host ' | | | | | | ' -ForegroundColor Cyan Write-Host ' | |_|__|_| | ' -ForegroundColor Cyan Write-Host ' | __ __ | ' -ForegroundColor Cyan Write-Host ' |__| || |__| ' -ForegroundColor Cyan Write-Host ' /___/ /__\ \___\ ' -ForegroundColor Cyan Write-Host '' } function Open-Url { param( [Parameter(Mandatory = $true)] [string] $Url ) Write-Host "Opening $Url" -ForegroundColor Cyan Start-Process $Url | Out-Null } Restart-ElevatedIfNeeded while ($true) { Write-Host '' Show-RobotBanner Write-Host 'Use at your own risk. You are responsible for reviewing and choosing what to run.' -ForegroundColor Yellow Write-Host 'Choose an option:' -ForegroundColor Green Write-Host '1. Windows Tweaks' Write-Host '2. Activate Things' Write-Host '3. Free Candy' Write-Host 'Q. Quit' Write-Host '' $choice = (Read-Host 'Selection').Trim().ToUpperInvariant() switch ($choice) { '1' { Invoke-RemoteScript -Url 'https://christitus.com/win' break } '2' { Invoke-RemoteScript -Url 'https://get.activated.win' break } '3' { Open-Url -Url 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' break } 'Q' { Write-Host 'Cancelled.' break } default { Write-Host 'Please choose 1, 2, 3, or Q.' -ForegroundColor Yellow } } }