Implement full deployment script suite (steps 1-7)
- Deploy-Windows.ps1: master script with Write-Log, Invoke-Step, summary report, DryRun support
- 01-bloatware.ps1: remove AppX packages, Windows Capabilities, Optional Features
- 02-software.ps1: winget installs from config.json, set Adobe Reader as default PDF app
- 03-system-registry.ps1: HKLM tweaks (NRO bypass, Teams, Widgets, Edge, OneDrive, GameDVR, Recall, timezone)
- 04-default-profile.ps1: NTUSER.DAT changes for taskbar, Explorer, Start menu, NumLock, Copilot
- 05-personalization.ps1: dark/light theme, accent color #223B47, transparency off, wallpaper
- 06-scheduled-tasks.ps1: ShowAllTrayIcons, PDF-DefaultApp, UnlockStartLayout tasks
- 07-desktop-info.ps1: DesktopInfo render script (System.Drawing BMP), scheduled task, deploy date registry
- tests/Test-Deployment.ps1: post-deployment verification, 30+ checks
- CLAUDE.md: add Czech communication preference
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 09:44:38 +01:00
|
|
|
param(
|
|
|
|
|
[object]$Config,
|
|
|
|
|
[string]$LogFile
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
$ErrorActionPreference = "Continue"
|
|
|
|
|
|
|
|
|
|
function Write-Log {
|
|
|
|
|
param([string]$Message, [string]$Level = "INFO")
|
|
|
|
|
$line = "[$(Get-Date -Format 'HH:mm:ss')] [$Level] $Message"
|
|
|
|
|
Add-Content -Path $LogFile -Value $line -Encoding UTF8
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
# Check winget availability
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
Write-Log "Checking winget availability" -Level INFO
|
|
|
|
|
|
|
|
|
|
$winget = Get-Command winget -ErrorAction SilentlyContinue
|
|
|
|
|
if (-not $winget) {
|
|
|
|
|
# Try to find winget in known locations
|
|
|
|
|
$wingetPaths = @(
|
|
|
|
|
"$env:LOCALAPPDATA\Microsoft\WindowsApps\winget.exe"
|
|
|
|
|
"$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller*\winget.exe"
|
|
|
|
|
)
|
|
|
|
|
foreach ($p in $wingetPaths) {
|
|
|
|
|
$found = Get-Item $p -ErrorAction SilentlyContinue | Select-Object -First 1
|
|
|
|
|
if ($found) { $winget = $found.FullName; break }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (-not $winget) {
|
|
|
|
|
Write-Log "winget not found - software installation skipped" -Level ERROR
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Log "winget found: $($winget.Source -or $winget)" -Level OK
|
|
|
|
|
|
|
|
|
|
# Accept agreements upfront
|
|
|
|
|
& winget source update --accept-source-agreements 2>&1 | Out-Null
|
|
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
# Install packages from config
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
if (-not $Config -or -not $Config.software -or -not $Config.software.install) {
|
|
|
|
|
Write-Log "No software list in config - skipping installs" -Level WARN
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($pkg in $Config.software.install) {
|
|
|
|
|
Write-Log "Installing $($pkg.name) ($($pkg.wingetId))" -Level INFO
|
|
|
|
|
$result = & winget install --id $pkg.wingetId `
|
|
|
|
|
--silent `
|
|
|
|
|
--accept-package-agreements `
|
|
|
|
|
--accept-source-agreements `
|
|
|
|
|
--disable-interactivity `
|
|
|
|
|
2>&1
|
|
|
|
|
|
|
|
|
|
$exitCode = $LASTEXITCODE
|
|
|
|
|
if ($exitCode -eq 0) {
|
|
|
|
|
Write-Log " Installed OK: $($pkg.name)" -Level OK
|
|
|
|
|
} elseif ($exitCode -eq -1978335189) {
|
|
|
|
|
# 0x8A150011 = already installed
|
|
|
|
|
Write-Log " Already installed: $($pkg.name)" -Level OK
|
|
|
|
|
} else {
|
|
|
|
|
Write-Log " Failed: $($pkg.name) (exit $exitCode)" -Level ERROR
|
|
|
|
|
Write-Log " Output: $($result -join ' ')" -Level ERROR
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
# Set Adobe Reader as default PDF app
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
$forcePdf = $true
|
|
|
|
|
if ($Config -and $Config.pdfDefault) {
|
|
|
|
|
$forcePdf = [bool]$Config.pdfDefault.forceAdobeReader
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($forcePdf) {
|
|
|
|
|
Write-Log "Setting Adobe Reader as default PDF app" -Level INFO
|
|
|
|
|
|
|
|
|
|
# Find AcroRd32.exe
|
|
|
|
|
$acroPaths = @(
|
|
|
|
|
"${env:ProgramFiles(x86)}\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"
|
|
|
|
|
"$env:ProgramFiles\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"
|
|
|
|
|
"${env:ProgramFiles(x86)}\Adobe\Reader\Reader\AcroRd32.exe"
|
|
|
|
|
)
|
|
|
|
|
$acroExe = $acroPaths | Where-Object { Test-Path $_ } | Select-Object -First 1
|
|
|
|
|
|
|
|
|
|
if (-not $acroExe) {
|
|
|
|
|
Write-Log " AcroRd32.exe not found - PDF default not set" -Level WARN
|
|
|
|
|
} else {
|
|
|
|
|
Write-Log " Found: $acroExe" -Level INFO
|
|
|
|
|
|
|
|
|
|
# Set file type association via HKCR (system-wide, requires admin)
|
|
|
|
|
$progId = "AcroExch.Document.DC"
|
|
|
|
|
$openCmd = "`"$acroExe`" `"%1`""
|
|
|
|
|
|
|
|
|
|
# HKCR\.pdf -> progId
|
|
|
|
|
if (-not (Test-Path "HKCR:\.pdf")) {
|
|
|
|
|
New-Item -Path "HKCR:\.pdf" -Force | Out-Null
|
|
|
|
|
}
|
|
|
|
|
Set-ItemProperty -Path "HKCR:\.pdf" -Name "(Default)" -Value $progId
|
|
|
|
|
|
|
|
|
|
# HKCR\AcroExch.Document.DC\shell\open\command
|
|
|
|
|
$cmdPath = "HKCR:\$progId\shell\open\command"
|
|
|
|
|
if (-not (Test-Path $cmdPath)) {
|
|
|
|
|
New-Item -Path $cmdPath -Force | Out-Null
|
|
|
|
|
}
|
|
|
|
|
Set-ItemProperty -Path $cmdPath -Name "(Default)" -Value $openCmd
|
|
|
|
|
|
|
|
|
|
# Also set in HKCU for current user (UserChoice)
|
|
|
|
|
$ucPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice"
|
|
|
|
|
if (-not (Test-Path $ucPath)) {
|
|
|
|
|
New-Item -Path $ucPath -Force | Out-Null
|
|
|
|
|
}
|
|
|
|
|
Set-ItemProperty -Path $ucPath -Name "ProgId" -Value $progId
|
|
|
|
|
|
|
|
|
|
Write-Log " PDF default set to AcroRd32" -Level OK
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Log "Step 2 complete" -Level OK
|