param( [ValidateSet("cli", "ui")] [string]$Mode = "ui" ) $ErrorActionPreference = "Stop" $BaseUrl = "https://tools.thesunrisecomputers.com" Write-Host "" Write-Host "Sunrise Computers – Windows Utility" -ForegroundColor Cyan Write-Host "Bootstrap loaded successfully" -ForegroundColor Green Write-Host "Selected mode: $Mode" Write-Host "" try { switch ($Mode) { "cli" { Write-Host "Launching CLI version..." -ForegroundColor Yellow $scriptContent = Invoke-WebRequest -Uri "$BaseUrl/cli.ps1" -TimeoutSec 30 -UseBasicParsing if ($scriptContent.StatusCode -eq 200) { Invoke-Expression $scriptContent.Content } } "ui" { Write-Host "Launching UI version..." -ForegroundColor Yellow $scriptContent = Invoke-WebRequest -Uri "$BaseUrl/ui.ps1" -TimeoutSec 30 -UseBasicParsing if ($scriptContent.StatusCode -eq 200) { Invoke-Expression $scriptContent.Content } } } } catch [System.Net.WebException] { Write-Host "" Write-Host "⚠ NETWORK ERROR: Cannot reach server" -ForegroundColor Red Write-Host "" Write-Host "Possible causes:" -ForegroundColor Yellow Write-Host " • No internet connection - check your network" -ForegroundColor White Write-Host " • Server is temporarily down - try again later" -ForegroundColor White Write-Host " • Firewall or antivirus blocking connection" -ForegroundColor White Write-Host " • DNS resolution failure" -ForegroundColor White Write-Host "" Write-Host "Troubleshooting:" -ForegroundColor Cyan Write-Host " 1. Test connectivity: ping tools.thesunrisecomputers.com" -ForegroundColor White Write-Host " 2. Try in browser: $BaseUrl/$Mode.ps1" -ForegroundColor White Write-Host " 3. Check Windows Firewall settings" -ForegroundColor White Write-Host "" throw } catch { Write-Host "" Write-Host "⚠ ERROR: Failed to launch Sunrise Computers Utility" -ForegroundColor Red Write-Host "" Write-Host "Error Details:" -ForegroundColor Yellow Write-Host " $($_.Exception.Message)" -ForegroundColor White Write-Host "" Write-Host "Verification URLs:" -ForegroundColor Cyan Write-Host " CLI: $BaseUrl/cli.ps1" -ForegroundColor White Write-Host " UI: $BaseUrl/ui.ps1" -ForegroundColor White Write-Host "" Write-Host "Server Requirements:" -ForegroundColor Cyan Write-Host " • .htaccess must set AddType text/plain .ps1" -ForegroundColor White Write-Host " • Files must be publicly accessible" -ForegroundColor White Write-Host " • HTTPS should be properly configured" -ForegroundColor White Write-Host "" throw }