From c5c1cf4845919c61cb128d7c34b0bae105964f0e Mon Sep 17 00:00:00 2001 From: Garrett Allen <98648590+Gerrrt@users.noreply.github.com> Date: Thu, 8 Oct 2026 07:15:59 -0700 Subject: [PATCH 1/3] fix(packer): one-shot AutoLogon so Windows 11 clones finish OOBE (#1092) A cloned Win11 endpoint (carbuncle, siren from template 911) parks on the OOBE "create a user account" page and never reaches a logon screen. The clone's answer file had HideLocalAccountScreen=true and the built-in Administrator but no AutoLogon, which sysprep.ps1 strips from the generalised image. On client SKUs that is not enough to finish the account page, so OOBE idles as defaultuser0; Server 2025 (912) is unaffected, which is why only the Win11 guests stall. The rest of Setup completes - the guests domain-join, run sshd and the agent, and verify.yml passes - so this is a cosmetic stall that only blocks an interactive console session. unattend-oobe.xml.pkrtpl now carries a one-shot AutoLogon (Administrator, LogonCount 1) with FirstLogonCommands that turn autologon off and delete the plaintext DefaultPassword Setup writes to Winlogon. The template itself still never autologins; only the clone's single OOBE pass does, then disables itself, mirroring the build's autounattend.xml. Needs a 911 rebuild to take effect, so this stays a draft until a rebuilt clone is seen landing at a normal logon screen. Refs #1092 Co-Authored-By: Claude Opus 4.8 --- packer/windows/unattend-oobe.xml.pkrtpl | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/packer/windows/unattend-oobe.xml.pkrtpl b/packer/windows/unattend-oobe.xml.pkrtpl index 2cd6dad7..99932d85 100644 --- a/packer/windows/unattend-oobe.xml.pkrtpl +++ b/packer/windows/unattend-oobe.xml.pkrtpl @@ -41,6 +41,39 @@ true</PlainText> </AdministratorPassword> </UserAccounts> + <!-- + AutoLogon ONCE, then off (#1092). Without it a Windows 11 clone parks + forever on the OOBE "create a user account" page: HideLocalAccountScreen + with only the built-in Administrator does not finish that page on client + SKUs, only on Server. The generalised image still never autologins - + scripts/sysprep.ps1 strips the build's autologon, and this file re-adds + it for the clone's single OOBE pass alone. LogonCount 1 spends it, and + the FirstLogonCommands below turn it off and delete the plaintext + DefaultPassword that Setup writes to Winlogon, so nothing persists past + that first logon. The built-in Administrator stays enabled with the + build password (above) until ansible/'s base role rotates it (#448). + --> + <AutoLogon> + <Enabled>true</Enabled> + <LogonCount>1</LogonCount> + <Username>Administrator</Username> + <Password> + <Value>${build_password}</Value> + <PlainText>true</PlainText> + </Password> + </AutoLogon> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <Order>1</Order> + <Description>Turn the one-shot autologon off</Description> + <CommandLine>reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f</CommandLine> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>2</Order> + <Description>Drop the plaintext credential Setup wrote to Winlogon</Description> + <CommandLine>reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f</CommandLine> + </SynchronousCommand> + </FirstLogonCommands> </component> </settings> </unattend> From d05e255c99c49fb7912b1d74ece7405534827237 Mon Sep 17 00:00:00 2001 From: Garrett Allen <98648590+Gerrrt@users.noreply.github.com> Date: Thu, 8 Oct 2026 17:46:33 -0700 Subject: [PATCH 2/3] fix(packer): log the OOBE autologon session off, so Win11 clones lock (#1092) Review on #1093 (verified on a scratch 911 clone) found the one-shot AutoLogon completes OOBE but leaves Administrator at an unlocked desktop. A third FirstLogonCommand, shutdown /l /f, logs that session off after the first two disable autologon and clear the stored credential, so the clone lands at the lock screen. Refs #1092 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --- packer/windows/unattend-oobe.xml.pkrtpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packer/windows/unattend-oobe.xml.pkrtpl b/packer/windows/unattend-oobe.xml.pkrtpl index 99932d85..bd9720c4 100644 --- a/packer/windows/unattend-oobe.xml.pkrtpl +++ b/packer/windows/unattend-oobe.xml.pkrtpl @@ -73,6 +73,11 @@ <Description>Drop the plaintext credential Setup wrote to Winlogon</Description> <CommandLine>reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f</CommandLine> </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>3</Order> + <Description>Log the one-shot autologon session off, so the clone lands at the lock screen rather than an unlocked Administrator desktop</Description> + <CommandLine>shutdown /l /f</CommandLine> + </SynchronousCommand> </FirstLogonCommands> </component> </settings> From 391863409fd91375ec499f255ae750ab0771a415 Mon Sep 17 00:00:00 2001 From: Garrett Allen <98648590+Gerrrt@users.noreply.github.com> Date: Fri, 9 Oct 2026 11:17:55 -0700 Subject: [PATCH 3/3] fix(packer): chain the OOBE first-logon commands so the logoff runs last (#1092) Windows 10 and 11 start FirstLogonCommands without waiting for the one before, so the separate logoff could end the session before AutoAdminLogon was cleared and DefaultPassword deleted. One cmd /c chain fixes the order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- packer/windows/unattend-oobe.xml.pkrtpl | 31 ++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/packer/windows/unattend-oobe.xml.pkrtpl b/packer/windows/unattend-oobe.xml.pkrtpl index bd9720c4..be96a660 100644 --- a/packer/windows/unattend-oobe.xml.pkrtpl +++ b/packer/windows/unattend-oobe.xml.pkrtpl @@ -48,10 +48,11 @@ SKUs, only on Server. The generalised image still never autologins - scripts/sysprep.ps1 strips the build's autologon, and this file re-adds it for the clone's single OOBE pass alone. LogonCount 1 spends it, and - the FirstLogonCommands below turn it off and delete the plaintext - DefaultPassword that Setup writes to Winlogon, so nothing persists past - that first logon. The built-in Administrator stays enabled with the - build password (above) until ansible/'s base role rotates it (#448). + the FirstLogonCommand below turns it off, deletes the plaintext + DefaultPassword that Setup writes to Winlogon and logs off, so nothing + persists past that first logon. The built-in Administrator stays + enabled with the build password (above) until ansible/'s base role + rotates it (#448). --> <AutoLogon> <Enabled>true</Enabled> @@ -62,21 +63,19 @@ <PlainText>true</PlainText> </Password> </AutoLogon> + <!-- + One command, not three. Windows 10 and 11 do not wait for one + SynchronousCommand to finish before starting the next, so a separate + logoff could end the session before the two reg commands ran, leaving + the autologon on and the password in Winlogon. Chained in one cmd, the + logoff can only come after both. & rather than &&: the session ends + even if a reg command fails, since LogonCount 1 is already spent. + --> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> - <Description>Turn the one-shot autologon off</Description> - <CommandLine>reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f</CommandLine> - </SynchronousCommand> - <SynchronousCommand wcm:action="add"> - <Order>2</Order> - <Description>Drop the plaintext credential Setup wrote to Winlogon</Description> - <CommandLine>reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f</CommandLine> - </SynchronousCommand> - <SynchronousCommand wcm:action="add"> - <Order>3</Order> - <Description>Log the one-shot autologon session off, so the clone lands at the lock screen rather than an unlocked Administrator desktop</Description> - <CommandLine>shutdown /l /f</CommandLine> + <Description>Turn the one-shot autologon off, drop the plaintext credential Setup wrote to Winlogon, then log the session off so the clone rests at the sign-in screen</Description> + <CommandLine>cmd /c "reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f &amp; reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f &amp; shutdown /l /f"</CommandLine> </SynchronousCommand> </FirstLogonCommands> </component>