Windows launcher only creates a differential disk; seed via Unattend.xml
run-windows11.py no longer installs Windows or touches ISO/img files: it creates a QCOW2 overlay on the base image (made by vm-images/build-windows-base.sh) and, when the disk is created, mounts seed.iso. Windows reads the Unattend.xml in its root during the specialize and OOBE passes (host name, account, auto logon, Remote Desktop) and Configure-Windows.ps1 then installs OpenSSH with the host's key, turns off Windows Update and copies the installer scripts. The VM hardware uses devices with inbox Windows drivers (IDE/NVMe, e1000e, ramfb on arm64), since the base image has no VirtIO drivers. Autounattend.xml moves to vm-images; the vm-images pointer is updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fe7250870e
commit
a920ba0ca5
11 files changed
+456
-735
No files matched your search
@@ -1,5 +1,4 @@
|
||||
param(
|
||||
[switch]$InstallVirtIO,
|
||||
[switch]$EnableAutomaticLogon,
|
||||
[switch]$DisableAutoUpdate,
|
||||
[switch]$CopyInstallers,
|
||||
@@ -35,72 +34,6 @@ if (-not (Test-Administrator)) {
|
||||
exit $elevated.ExitCode
|
||||
}
|
||||
|
||||
# The guest tools installer is an x86 program and the VirtIO ISO has no Arm64
|
||||
# package for it, so on Arm64 Windows the Arm64 drivers are installed from their
|
||||
# folders on the ISO instead. NetKVM is the network driver; without it the guest
|
||||
# has no network.
|
||||
function Install-VirtIOArm64Drivers {
|
||||
$roots = (Get-PSDrive -PSProvider FileSystem).Root
|
||||
$drivers = @(
|
||||
@{ Folder = 'NetKVM'; Inf = 'netkvm.inf' },
|
||||
@{ Folder = 'vioserial'; Inf = 'vioser.inf' },
|
||||
@{ Folder = 'Balloon'; Inf = 'balloon.inf' },
|
||||
@{ Folder = 'viorng'; Inf = 'viorng.inf' },
|
||||
@{ Folder = 'vioinput'; Inf = 'vioinput.inf' },
|
||||
@{ Folder = 'viogpudo'; Inf = 'viogpudo.inf' }
|
||||
)
|
||||
|
||||
$installed = 0
|
||||
foreach ($driver in $drivers) {
|
||||
$inf = $roots |
|
||||
ForEach-Object { Join-Path $_ "$($driver.Folder)\w11\ARM64\$($driver.Inf)" } |
|
||||
Where-Object { Test-Path -LiteralPath $_ } |
|
||||
Select-Object -First 1
|
||||
if (-not $inf) {
|
||||
if ($driver.Folder -eq 'NetKVM') {
|
||||
throw 'The Arm64 NetKVM driver was not found on the attached media.'
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
& pnputil.exe /add-driver $inf /install | Out-Host
|
||||
# 3010 asks for a restart; 259 means that no device uses the driver.
|
||||
if ($LASTEXITCODE -notin 0, 259, 3010) {
|
||||
throw "pnputil failed to install $inf (exit code $LASTEXITCODE)."
|
||||
}
|
||||
$installed++
|
||||
}
|
||||
Write-Host "Installed $installed VirtIO Arm64 driver packages."
|
||||
}
|
||||
|
||||
function Install-VirtIOGuestTools {
|
||||
if ([Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq 'Arm64') {
|
||||
Install-VirtIOArm64Drivers
|
||||
return
|
||||
}
|
||||
|
||||
$installer = Get-ChildItem `
|
||||
-Path (Get-PSDrive -PSProvider FileSystem).Root `
|
||||
-Filter 'virtio-win-guest-tools.exe' `
|
||||
-File `
|
||||
-ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1
|
||||
|
||||
if (-not $installer) {
|
||||
throw 'virtio-win-guest-tools.exe was not found on the attached media.'
|
||||
}
|
||||
|
||||
$process = Start-Process `
|
||||
-FilePath $installer.FullName `
|
||||
-ArgumentList '/quiet', '/norestart' `
|
||||
-Wait `
|
||||
-PassThru
|
||||
|
||||
if ($process.ExitCode -notin 0, 3010) {
|
||||
throw "VirtIO guest tools installer exited with code $($process.ExitCode)."
|
||||
}
|
||||
}
|
||||
|
||||
function Enable-AutomaticLogon {
|
||||
$winlogonPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
|
||||
|
||||
@@ -205,9 +138,6 @@ function Install-OpenSSHServer {
|
||||
|
||||
$exitCode = 0
|
||||
try {
|
||||
if ($InstallVirtIO) {
|
||||
Install-VirtIOGuestTools
|
||||
}
|
||||
if ($EnableAutomaticLogon) {
|
||||
Enable-AutomaticLogon
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user