# Bootstrap script for Jaytag IT Setup # This prompts for credentials and then downloads the selected setup script Write-Host "==========================================================================" -ForegroundColor Cyan Write-Host " JAYTAG IT - WORKSTATION SETUP AUTHENTICATION " -ForegroundColor Cyan Write-Host "==========================================================================" -ForegroundColor Cyan Write-Host "" Write-Host " Please enter your credentials to access the setup scripts." -ForegroundColor Yellow Write-Host "" # Prompt for credentials $cred = Get-Credential -Message "Enter setup access credentials" if (-not $cred) { Write-Host "" Write-Host " Authentication cancelled. Exiting." -ForegroundColor Red return } Write-Host "" Write-Host " Authenticating..." -ForegroundColor Cyan # Test authentication by trying to access a protected resource try { $testUrl = "https://sw.jaytag.co.uk/setup/.protected/setup.ps1" Invoke-WebRequest -Uri $testUrl -Credential $cred -UseBasicParsing -Method Head -ErrorAction Stop | Out-Null Write-Host " Authentication successful!" -ForegroundColor Green } catch { Write-Host "" Write-Host " Authentication failed!" -ForegroundColor Red Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Red Write-Host "" return } # Display menu Write-Host "" Write-Host "==========================================================================" -ForegroundColor Cyan Write-Host " SELECT SETUP TYPE " -ForegroundColor Cyan Write-Host "==========================================================================" -ForegroundColor Cyan Write-Host "" Write-Host " [1] Full Workstation Setup" -ForegroundColor White Write-Host " - Includes bloatware removal, CommonStuff, PSWindowsUpdate" -ForegroundColor Gray Write-Host " - Complete provisioning with all tools" -ForegroundColor Gray Write-Host "" Write-Host " [2] Barebones Setup" -ForegroundColor White Write-Host " - Essential tools only (RMM, AV, Inventory)" -ForegroundColor Gray Write-Host " - Faster, minimal installation" -ForegroundColor Gray Write-Host "" Write-Host " [X] Exit" -ForegroundColor White Write-Host " - Cancel and exit without making changes" -ForegroundColor Gray Write-Host "" do { Write-Host " Enter your choice [1-2, X]: " -ForegroundColor Yellow -NoNewline $choice = Read-Host $choice = $choice.ToUpper() } while ($choice -notin @('1', '2', 'X')) # Handle exit choice if ($choice -eq 'X') { Write-Host "" Write-Host " Setup cancelled. No changes made." -ForegroundColor Yellow Write-Host "" return } # Set the URL based on choice $setupUrl = switch ($choice) { '1' { Write-Host "" Write-Host " Starting Full Workstation Setup..." -ForegroundColor Cyan "https://sw.jaytag.co.uk/setup/.protected/setup.ps1" } '2' { Write-Host "" Write-Host " Starting Barebones Setup..." -ForegroundColor Cyan "https://sw.jaytag.co.uk/setup/.protected/barebones.ps1" } } Write-Host "" Start-Sleep -Seconds 1 try { # Download the selected setup script with credentials $response = Invoke-WebRequest -Uri $setupUrl -Credential $cred -UseBasicParsing -ErrorAction Stop # Execute the downloaded script (Content is already a string with -UseBasicParsing) & ([scriptblock]::Create($response.Content)) } catch { Write-Host "" Write-Host " Failed to download or execute setup script." -ForegroundColor Red Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Red Write-Host "" return }