Files
homelab-infra/ops/windows-reinstall/postinstall-unigetui.ps1
T
2026-05-15 16:05:34 +02:00

35 lines
1.1 KiB
PowerShell

param(
[string]$BackupRoot = "H:\Windows-Neuaufsetzen-Backup",
[switch]$ImportWingetList
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
if (-not (Get-Command winget -ErrorAction SilentlyContinue)) {
throw "winget is not available. Install or update App Installer from Microsoft Store first."
}
Write-Host "Installing UniGetUI..."
winget install --exact --id Devolutions.UniGetUI --source winget --accept-package-agreements --accept-source-agreements
$WingetExport = Join-Path $BackupRoot "12_Exportierte_Listen\winget-export.json"
if ($ImportWingetList) {
if (-not (Test-Path $WingetExport)) {
throw "WinGet export file not found: $WingetExport"
}
Write-Host "Importing WinGet package list..."
Write-Host "Source: $WingetExport"
winget import --import-file $WingetExport --accept-package-agreements --accept-source-agreements
} else {
Write-Host ""
Write-Host "UniGetUI installed."
Write-Host "WinGet export is available here:"
Write-Host " $WingetExport"
Write-Host ""
Write-Host "Review the list before importing. To import later, run:"
Write-Host " .\postinstall-unigetui.ps1 -ImportWingetList"
}