generalize: drop CopyProfile when relocating profiles, and name FolderLocations twice

The data volume comes out correctly partitioned, formatted and labelled, and
containing nothing but $RECYCLE.BIN and System Volume Information -- so the
disk work lands and the relocation does not. Two candidates, both cheap to
address together.

CopyProfile is now dropped whenever profilesDirectory is set. Sysprep choosing
a profile to copy into Default while the profile root is being moved is the
likelier of the two, and a profile that persists is worth more than the Audit
Mode customizations that CopyProfile preserves.

FolderLocations is now named in oobeSystem as well as specialize. Which pass
honours it is not something the documentation is crisp about, and saying it
twice costs nothing.

This matters more than it looks: with UWF protecting C: and the profile still
on C:, every profile write lands in the overlay and is discarded on reboot,
which makes the whole VM stateless.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117qMyjpuXsjpVAcpJbFD8g
This commit is contained in:
Git Sagar 2026-09-10 06:10:35 -03:00
parent 23c539dbe2
commit c0e1293405

View file

@ -247,11 +247,20 @@ in
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<!-- Copy Administrator profile to default (preserves Audit Mode customizations) -->
<!-- CopyProfile bakes the Audit Mode customizations into the Default
profile, but it is dropped when profiles are being relocated: the
two interfere, and sysprep picking a profile to copy while the
profile root is moving underneath it is the likelier reason a
correctly formatted data volume came back holding nothing. Having a
profile that persists matters more than the customizations do.
FolderLocations appears in both passes on purpose. Which one
actually honours it is not something the documentation is crisp
about, and naming it twice costs nothing. -->
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<CopyProfile>true</CopyProfile>
${lib.optionalString (profilesDirectory == null) " <CopyProfile>true</CopyProfile>"}
<Themes>
<WindowColor>Automatic</WindowColor>
</Themes>
@ -302,6 +311,7 @@ ${dataDiskXml}
<Username>${username}</Username>
</AutoLogon>
<ComputerName>${hostname}</ComputerName>
${folderLocationsXml}
<TimeZone>${timezone}</TimeZone>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">