# 2>NUL & @CLS & PUSHD "%~dp0" & "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -noLogo -noProfile -ExecutionPolicy bypass "[IO.File]::ReadAllText('%~f0')|iex" & POPD & EXIT /B # Check and install dependencies if needed Write-Host "Controleer dependencies..." -ForegroundColor Yellow # Check if winget is available try { $wingetVersion = winget --version 2>$null if ($wingetVersion) { Write-Host "winget is beschikbaar: $wingetVersion" -ForegroundColor Green } else { throw "winget niet gevonden" } } catch { Write-Host "winget niet gevonden. Probeer te installeren..." -ForegroundColor Red # Try to install winget from Microsoft Store try { Write-Host "Installeer winget via Microsoft Store..." -ForegroundColor Yellow Start-Process "ms-windows-store://pdp/?ProductId=9NBLGGH4NNS1" -Wait Write-Host "Controleer of winget nu beschikbaar is..." -ForegroundColor Yellow # Wait a bit and check again Start-Sleep -Seconds 5 $wingetVersion = winget --version 2>$null if ($wingetVersion) { Write-Host "winget succesvol geïnstalleerd: $wingetVersion" -ForegroundColor Green } else { throw "winget installatie mislukt" } } catch { Write-Host "Automatische winget installatie mislukt. Probeer handmatig:" -ForegroundColor Red Write-Host "1. Open Microsoft Store" -ForegroundColor White Write-Host "2. Zoek naar 'App Installer'" -ForegroundColor White Write-Host "3. Installeer de App Installer" -ForegroundColor White Write-Host "4. Herstart PowerShell en voer dit script opnieuw uit" -ForegroundColor White Read-Host "Druk op Enter om af te sluiten" exit 1 } } # Check if running as administrator $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") if (-not $isAdmin) { Write-Host "Dit script moet als Administrator worden uitgevoerd voor machine-wide installaties." -ForegroundColor Red Write-Host "Start PowerShell opnieuw als Administrator en voer dit script opnieuw uit." -ForegroundColor Yellow Read-Host "Druk op Enter om af te sluiten" exit 1 } Write-Host "Alle dependencies zijn beschikbaar. Start met app installaties..." -ForegroundColor Green Write-Host "" # Install apps $apps = @( "Microsoft.DotNet.DesktopRuntime.8", "Google.Chrome", "Google.GoogleDrive", "Google.ChromeRemoteDesktopHost", "Dell.CommandUpdate", "Logitech.OptionsPlus", "Notepad++.Notepad++", "Adobe.Acrobat.Reader.64-bit" ) $totalApps = $apps.Count $currentApp = 0 foreach ($app in $apps) { $currentApp++ Write-Host "[$currentApp/$totalApps] Installeer $app..." -ForegroundColor Cyan try { Start-Process -NoNewWindow -Wait -FilePath "winget" -ArgumentList "install --id $app -e --silent --accept-package-agreements --accept-source-agreements --source winget --scope machine" Write-Host "✓ $app succesvol geïnstalleerd" -ForegroundColor Green } catch { Write-Host "✗ Fout bij installatie van $app" -ForegroundColor Red Write-Host "Foutdetails: $($_.Exception.Message)" -ForegroundColor Red } Write-Host "" } Write-Host "App installatie voltooid!" -ForegroundColor Green Read-Host "Druk op Enter om af te sluiten"