Files
2026-07-21 09:57:55 +02:00

99 lines
3.5 KiB
PowerShell

# Remote Script Launcher - Download and execute scripts from Git repository
# No installation required - run directly from internet
param(
[Parameter(Mandatory=$false)]
[ValidateSet('All', 'HP', 'Lenovo', 'ASUS', 'Dell', 'Scan', 'Verify', 'Deploy')]
[string]$Script = 'All',
[Parameter(Mandatory=$false)]
[string]$RepoURL = 'https://git.azuze.fr/kawa/Kawa-s-Bloat-Remover',
[Parameter(Mandatory=$false)]
[string]$Branch = 'main',
[Parameter(Mandatory=$false)]
[switch]$NoAdmin = $false
)
# Check for admin rights
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
if (-not $NoAdmin) {
Write-Host "[!] Admin rights required. Requesting elevation..." -ForegroundColor Yellow
$Arguments = "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`" -Script $Script -RepoURL $RepoURL -Branch $Branch"
Start-Process powershell.exe -ArgumentList $Arguments -Verb RunAs -Wait
exit
}
}
$ErrorActionPreference = 'SilentlyContinue'
$ProgressPreference = 'SilentlyContinue'
Write-Host "╔════════════════════════════════════════╗" -ForegroundColor Cyan
Write-Host "║ Kawa's Bloatware Remover - Remote ║" -ForegroundColor Cyan
Write-Host "║ Launching from Git Repository ║" -ForegroundColor Cyan
Write-Host "╚════════════════════════════════════════╝" -ForegroundColor Cyan
Write-Host ""
# Map script names to files
$ScriptMap = @{
'All' = 'Remove-AllBloat.ps1'
'HP' = 'Remove-HPBloat.ps1'
'Lenovo' = 'Remove-LenovoBloat.ps1'
'ASUS' = 'Remove-ASUSBloat.ps1'
'Dell' = 'Remove-DellBloat.ps1'
'Scan' = 'Scan-Bloatware.ps1'
'Verify' = 'Verify-Removal.ps1'
'Deploy' = 'Deploy-ScheduledTask.ps1'
}
$ScriptFile = $ScriptMap[$Script]
if (-not $ScriptFile) {
Write-Host "[-] Invalid script selection: $Script" -ForegroundColor Red
exit 1
}
# Construct raw file URL
$RawURL = "$RepoURL/raw/$Branch/$ScriptFile"
Write-Host "[*] Repository: $RepoURL" -ForegroundColor Cyan
Write-Host "[*] Branch: $Branch" -ForegroundColor Cyan
Write-Host "[*] Script: $ScriptFile" -ForegroundColor Cyan
Write-Host "[*] URL: $RawURL" -ForegroundColor Cyan
Write-Host ""
# Download script
Write-Host "[*] Downloading script from repository..." -ForegroundColor Yellow
try {
$ScriptContent = Invoke-WebRequest -Uri $RawURL -UseBasicParsing -ErrorAction Stop
if ($ScriptContent.StatusCode -ne 200) {
Write-Host "[-] Failed to download script (HTTP $($ScriptContent.StatusCode))" -ForegroundColor Red
exit 1
}
Write-Host "[+] Script downloaded successfully" -ForegroundColor Green
Write-Host ""
# Execute script
Write-Host "[*] Executing $Script bloatware removal..." -ForegroundColor Yellow
Write-Host ""
Invoke-Expression $ScriptContent.Content
} catch {
Write-Host "[-] Error: $_" -ForegroundColor Red
Write-Host ""
Write-Host "Troubleshooting:" -ForegroundColor Yellow
Write-Host " 1. Check internet connection"
Write-Host " 2. Verify repository URL: $RepoURL"
Write-Host " 3. Confirm branch name: $Branch"
Write-Host " 4. Check firewall/proxy settings"
exit 1
}
Write-Host ""
Write-Host "[+] Remote execution complete!" -ForegroundColor Green