From 96c689b03e7d37edb7684542bda8107b655ea71f Mon Sep 17 00:00:00 2001 From: Guofang Date: Thu, 15 Oct 2026 10:00:37 +0800 Subject: [PATCH] Make VirtIO and automatic logon opt-in in the Windows 11 configure script Add -InstallVirtIO and -EnableAutomaticLogon switches to Configure-Windows.ps1 so it can run standalone on a physical machine. Autounattend.xml passes both switches during the virtual machine install. Co-Authored-By: Claude Sonnet 5.5 --- seediso/windows11/Autounattend.xml | 2 +- seediso/windows11/Configure-Windows.ps1 | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/seediso/windows11/Autounattend.xml b/seediso/windows11/Autounattend.xml index f262c21..95edb89 100644 --- a/seediso/windows11/Autounattend.xml +++ b/seediso/windows11/Autounattend.xml @@ -162,7 +162,7 @@ 1 Configure Windows from the answer-media script - powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$script = Get-ChildItem -Path (Get-PSDrive -PSProvider FileSystem).Root -Filter 'Configure-Windows.ps1' -File -ErrorAction SilentlyContinue | Select-Object -First 1; if (-not $script) { throw 'Configure-Windows.ps1 was not found on the attached media.' }; & $script.FullName" + powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$script = Get-ChildItem -Path (Get-PSDrive -PSProvider FileSystem).Root -Filter 'Configure-Windows.ps1' -File -ErrorAction SilentlyContinue | Select-Object -First 1; if (-not $script) { throw 'Configure-Windows.ps1 was not found on the attached media.' }; & $script.FullName -InstallVirtIO -EnableAutomaticLogon" false diff --git a/seediso/windows11/Configure-Windows.ps1 b/seediso/windows11/Configure-Windows.ps1 index 9ac2203..91295f1 100644 --- a/seediso/windows11/Configure-Windows.ps1 +++ b/seediso/windows11/Configure-Windows.ps1 @@ -1,3 +1,8 @@ +param( + [switch]$InstallVirtIO, + [switch]$EnableAutomaticLogon +) + $ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest @@ -91,7 +96,11 @@ function Enable-AutomaticLogon { Remove-ItemProperty -Path $winlogonPath -Name 'AutoLogonCount' -ErrorAction SilentlyContinue } -Install-VirtIOGuestTools +if ($InstallVirtIO) { + Install-VirtIOGuestTools +} Install-OpenSSHServer Install-AdministratorAuthorizedKey -Enable-AutomaticLogon +if ($EnableAutomaticLogon) { + Enable-AutomaticLogon +}