Initial commit: Packer + QEMU/KVM Windows 11 minimal VM

Fully unattended Windows 11 Pro build using Autounattend.xml, swtpm
for TPM 2.0 emulation, and VirtIO drivers. Five PowerShell provisioners
strip bloatware, telemetry, unused services, and apply performance tuning
for a resource-constrained host. Output is a compressed QCOW2 image.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 19:31:18 -05:00
commit e4741ccc96
12 changed files with 980 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
#Requires -RunAsAdministrator
# ── Power plan: High Performance ────────────────────────────────────────────
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
# ── Hibernate: off (saves ~RAM-size on disk) ─────────────────────────────────
powercfg /hibernate off
# ── System Restore: off (saves disk and shadow-copy overhead) ────────────────
Disable-ComputerRestore -Drive "C:\" -ErrorAction SilentlyContinue
vssadmin delete shadows /for=C: /all /quiet 2>$null
# ── Visual effects: best performance ─────────────────────────────────────────
$ve = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects"
New-Item -Path $ve -Force -ErrorAction SilentlyContinue | Out-Null
Set-ItemProperty -Path $ve -Name VisualFXSetting -Value 2 -Type DWord
$desktop = "HKCU:\Control Panel\Desktop"
Set-ItemProperty -Path $desktop -Name DragFullWindows -Value "0"
Set-ItemProperty -Path $desktop -Name MenuShowDelay -Value "0"
$adv = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
Set-ItemProperty -Path $adv -Name TaskbarAnimations -Value 0 -Type DWord
Set-ItemProperty -Path $adv -Name DisallowShaking -Value 1 -Type DWord
# ── Page file: fixed size to avoid resize churn ──────────────────────────────
$cs = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges
$cs.AutomaticManagedPagefile = $false
$cs.Put() | Out-Null
$pf = Get-WmiObject -Query "Select * From Win32_PageFileSetting Where Name='C:\\pagefile.sys'"
if ($pf) {
$pf.InitialSize = 2048
$pf.MaximumSize = 4096
$pf.Put() | Out-Null
}
# ── NTFS: skip Last Access Time updates ──────────────────────────────────────
fsutil behavior set disablelastaccess 1 | Out-Null
# ── Processor scheduling: favor background services (better for VM workloads) ─
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\PriorityControl" `
-Name Win32PrioritySeparation -Value 24 -Type DWord