autounattend only works on a few devices


Cormax

Member
Local time
4:04 PM
Posts
2
OS
Windows 11
Hey everyone,

as usual I've created an autounattend.xml file from schneegans.de which always have worked perfectly fine under Win10.
I also wanted to create a new one for my now upcoming Win11 installation so I generated one and put it on a freshly made Boot stick with a new Win11 ISO-Image from Microsoft.
But for some reason the setup ignores the autounattend file entirely and goes into manual setup.

I read on some websites that 24H2 brought some problems.
But here it comes: I used the exact same Boot stick with the exact same autounattend file on an older Dell notebook and it installed Win11 with all the configuration set in the autounattend.

So the stick itself works fine and even the autounattend file works fine. Just for some reason not on my PC.
So I was wondering if maybe there are some BIOS settings that prevent the autounattend file from working. I tried it by turning of Fast-Boot und Secure-Boot but it was still the same.

Has anyone an idea what setting could cause all of this?
Also: The autounattend worked fine with my Win10 stick on this PC. The Win11 one just doesn't - even though it's working on other PCs...

Thank you in advance!
 

My Computer My Computer

At a glance

Windows 11AMD Ryzen 9800x3D64 GB Kingston Fury DDR5-6000AMD Radeon RX 7900 XTX
OS
Windows 11
Computer type
PC/Desktop
CPU
AMD Ryzen 9800x3D
Motherboard
ASUS ROG STRIX X670E-F
Memory
64 GB Kingston Fury DDR5-6000
Graphics Card(s)
AMD Radeon RX 7900 XTX

My Computer My Computer

At a glance

Windows 11 Pro 25H212th Gen Core i7-1260P64 GB Micron PC4-25600Intel Iris Xe Graphics
OS
Windows 11 Pro 25H2
Computer type
PC/Desktop
Manufacturer/Model
Intel NUC12WSHi7
CPU
12th Gen Core i7-1260P
Motherboard
NUC12WSBi7
Memory
64 GB Micron PC4-25600
Graphics Card(s)
Intel Iris Xe Graphics
Sound Card
on-board Realtek HD Audio
Monitor(s) Displays
Dell U3219Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung SSD 990 PRO 1TB
Crucial MX500 2 TB
Antivirus
Microsoft Defender
Hmmm, that's an odd one. I have not seen Windows setup simply ignore the answer file outright, unless there is some very fundamental element that is causing it to get ignored right away.

Could I just ask about how that USB Flash Drive is configured? Is it a single partition? If so, is it FAT32, exFAT, or NTFS formatted? Is the answer file located in the root of the drive as "autounattend.xml" (check every letter of the spelling!)?

If you are using a dual partition arrangement on the UFD, tell me exactly how you created it and where the autounattend.xml file is located.

Also, could you tell me what you are doing with your answer file? Are you just doing the basics of answering the questions that setup would ask during a manual setup of Windows or are you doing anything really fancy with it?

If you are doing just the basics, you can see if my batch file below creates a good answer file for you.

To use it, copy the contents of the box below into notepad. Save the file with a name ending with ".bat". For example, "AnsFileGenerator.bat". Run the batch file. NOTE: I suggest selecting INTERACTIVE mode the first time you use it. Automatic mode requires you to set some variables in the batch file first and is good if you want repeatability so you don't have to respond with the same info over and over. But use interactive mode the first time.

The answer file will get created in the same location that you run the batch file from. Note that it will create the user that you specify with a password of "Password1". You will just need to change the password after Windows is done installing.

Finally, is there any chance that you could post a copy of your answer file here?

Batch:
:: Version 1.0.1.2 - Aug 24, 2025

@echo off
setlocal enabledelayedexpansion
setlocal enableextensions
cd /d %~dp0



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::                                                                                                                   ::
:: IMPORTANT: For all settings where a size is requested, enter the size in MB. For example, if you want to specify  ::
::    a size of 1 GB, enter 1000 size 1 GB is 1000 MB.                                                               ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::                                                                                                                   ::
:: SystemType - Set to either "BIOS" or "UEFI". If your system is UEFI capable, it is STRONGLY suggested to disable  ::
::    CSM (Compatibility Support Module) if this option is present and run in pure UEFI mode. Set the SystemType     ::
::    variable to BIOS only if your system is a legacy BIOS based system.                                            ::
::                                                                                                                   ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::                 ::
:: The following group of variables are used only in answer files created for use with UEFI based ::                 ::
:: systems. These variables are ignored for an answer file created for use with a legacy BIOS.    ::                 ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::                 ::
::                                                                                                                   ::
:: EfiParSize - Size of the EFI partition (applies only to an answer file created for UEFI systems).                 ::
::                                                                                                                   ::
:: MsrParSize - Size of the MSR partition (applies only to an answer file created for UEFI systems).                 ::
::                                                                                                                   ::
:: WinParSize - This allows you to set the size for the Windows partition in MB. Note that this entry is ignored if  ::
::    LimitWinParSize is set to "N" or if the system type is legacy BIOS.                                            ::
::                                                                                                                   ::
:: LimitWinParSize - If you want to limit the size of the Windows partition in order to leave room to create         ::
::    additional user partition(s), then set this to "Y". Set to "N" allow the Windows partition to fill the drive.  ::
::    Note that the batch file already reserves space for the other necessary partitions (EFI, MST, and WinRE).      ::
::    IMPORTANT: This option is ignored for legacy BIOS systems. We may consider enabling this function for legacy   ::
::    BIOS based systems at a later date if there is a demand for it.                                                ::
::                                                                                                                   ::
:: BypassDeviceEncryption - Set this to "Y" to bypass automatic device encryption on elegible systems or "N" to      ::
::    allow automatic device encryption.                                                                             ::
::                                                                                                                   ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::                                     ::
:: The remaining variables are applicable to both BIOS and UEFI based systems ::                                     ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::                                     ::
::                                                                                                                   ::
:: WinReParSize - Size of the Windows Recovery Environment (WinRE) partition.                                        ::
::                                                                                                                   ::
:: DiskID - Set this to the Disk ID of the disk to which Windows is to be installed. Make 100% sure that you know    ::
::    the correct ID because that disk will be wiped.                                                                ::
::                                                                                                                   ::
:: UserLocale - Normally you would set this en-US. To get a minimal, clean start screen, set this to en-001.         ::
::                                                                                                                   ::
:: ProductKey - Set this to the generic key for the edition of Windows that you wish to use.                         ::
::                                                                                                                   ::
:: Name - This is the user name to be created that will be assigned the role of an Administrator.                    ::
::    Example: WinUser                                                                                               ::
::                                                                                                                   ::
:: DisplayName - This is the long name / full name for the user that is displayed in places like the Logon screen.   ::
::    Example: Windows User                                                                                          ::
::                                                                                                                   ::
:: TimeZone - Set this to the time zone in which the system will operate. For a list of valid time zones, enter      ::
::    the command "tzutil /L" from a command prompt.                                                                 ::
::                                                                                                                   ::
:: ComputerName - If left blank, a random name will be assigned. You can also specify a name of up to 15 characters  ::
::    in length but be careful not to use the same name on multiple machines. If installing on multiple computers,   ::
::    it is best to leave this field blank and then change the computer name after installation of Windows.          ::
::                                                                                                                   ::
:: BypassWinRequirements - Set to "Y" if you want to bypass Windows 11 system requirements. Set to "N" if you do not ::
::    want to bypass the requirements. NOTE: You can set this to "Y" even if your system meets requirements. This    ::
::    will allow you to use the same answer on a system whether it meets requirements or not.                        ::
::                                                                                                                   ::
:: BypassQualityUpdatesDuringOobe - Set to "Y" to skip installation of the latest Windows quality updates during     ::
::    Windows installation. If you want to allow these updates, then set this to "N".                                ::
::                                                                                                                   ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: USER MUST SET THE VALUES FOR THE VARIABLES BELOW. EACH VARIABLE IS DESCRIBED IN DETAIL ABOVE ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

set SystemType=UEFI
set EfiParSize=260
set MsrParSize=128
set WinParSize=358400
set LimitWinParSize=N
set BypassDeviceEncryption=y
set WinReParSize=2000
set DiskId=0
set UserLocale=en-US
set ProductKey=VK7JG-NPHTM-C97JM-9MPGT-3V66T
set Name=WinUser
set DisplayName=Windows User
set TimeZone=Central Standard Time
set ComputerName=
set BypassWinRequirements=Y
set BypassQualityUpdatesDuringOobe=Y

:::::::::::::::::::::::::::::::::::
:: END OF USER DEFINED VARIABLES ::
:::::::::::::::::::::::::::::::::::

:: For some of the above variables, the case of the contents should be all uppercase. Just in case the user did not
:: supply all caps responses to these variables, we will convert them now to avoid potential errors.

call ::TOUPPERCASE SystemType
call ::TOUPPERCASE LimitWinParSize
call ::TOUPPERCASE BypassDeviceEncryption
call ::TOUPPERCASE ProductKey
call ::TOUPPERCASE BypassWinRequirements
call ::TOUPPERCASE BypassQualityUpdatesDuringOobe

:: Ask user if they want to run interactivly or in automatic mode.

cls
echo This batch batch can be run in one of two ways:
echo.
echo 1) Interactivly
echo 2) Automatic mode
echo.
echo In interactive mode, the batch file will ask you for all the information needed to create an answer file. In
echo automatic mode, all the information is supplied to the batch file by variables defined at the beginning of the batch
echo file. Before running this batch file in automatic mode you should set all of those variables. The purpose of each
echo variable is clearly defined in the comments before the variables.
echo.
echo What good is automatic mode if you have to provide the information by setting the variables anyway?
echo.
echo In a word: Repeatability. If you plan to create nearly the same answer file repeatedly, and maybe just change a
echo parameter or two, then the automatic mode will make this easier since you won't need to provide every piece of
echo information all over again every time you run the batch file.
echo.
echo If you plan to choose automatic mode, please make certain that you have set the user defined variables first. If you
echo have not already done so, close this batch file now and set the variables.
echo.
choice /C 12 /N /M "Press 1 for Interactive Mode or 2 for Automatic Mode:"
if errorlevel 2 goto RunAutoMode
if errorlevel 1 goto RunInteractiveMode

:RunInteractiveMode

:: In interactive mode, we are not using the predefinbed variables so we will clear the variables now. As an exception,
:: we are prepopulating the ProductKey variable with the Pro edition key so that the user can simply hit enter to
:: select Pro. We also prepopulate TimeZone to "Central Standard Time".
set SystemType=
set EfiParSize=
set MsrParSize=
set LimitWinParSize=
set WinParSize=
set BypassDeviceEncryption=
set WinReParSize=
set DiskId=
set UserLocale=
set ProductKey=VK7JG-NPHTM-C97JM-9MPGT-3V66T
set Name=
set DisplayName=
set TimeZone=Central Standard Time
set ComputerName=
set BypassWinRequirements=
set BypassQualityUpdatesDuringOobe=

:: We will ask the user if the answer file is being created for a BIOS based system or for a UEFI based system. For
:: UEFI based systems, there are some unique settings that we need to ask for that don't apply to BIOS based systems.
:: If the user is creating an answer file for a UEFI based system then we need to gather that information. If not, then
:: we can move on to gathering the information common to both BIOS and UEFI systems.

cls
echo Select the system type on which this answer file will be used:
echo.
echo 1 - BIOS based system
echo 2 - UEFI based system
echo.
choice /C 12 /N /M "Press 1 or 2 to make your selection:"
if errorlevel 2 set SystemType=UEFI & goto GetInfoForUefiSys
if errorlevel 1 set SystemType=BIOS & goto CommonInfo

:GetInfoForUefiSys

:: The information gathered from the user in this section is needed only for UEFI based systems.

cls
echo Enter the size in MB to make the EFI partition. On most systems, a size of 100 MB is fine, but on 4k native format
echo drives you should make this 260 MB since the minimum partition size for FAT32 on those drives is 260 MB.
echo TIP: If you want to guarantee compatibility on any system, use 260 MB. By doing so, you can use the same
echo answer file on any system.
echo.
set /p EfiParSize="Enter the size in MB to make the EFI partition: "

cls
echo Enter the size for the Microsoft Reserved partition (MSR) in MB. It is suggested to use 16 MB.
echo.
set /p MsrParSize="Enter the size in MB to make the Microsoft Reserved partition (MSR) (suggested 16 MB): "

cls
echo Do you want to prevent automatic device encryption on eligible systems?
echo.
echo Windows can automatically encrypt the Windows partition on some UEFI systems. We can prevent this from happening.
echo.
choice /c YN /n /m "Prevent automatic device encryption? Press Y for YES or N for NO:"
if errorlevel 2 set BypassDeviceEncryption=N & goto AskAboutLimitingSize
if errorlevel 1 set BypassDeviceEncryption=Y & goto AskAboutLimitingSize

:AskAboutLimitingSize

cls
echo Do you want to limit the size of the Windows partition? If you do not limit the size then the Windows partition will
echo occupy all remaining space on the drive not used by the other partitions. If you choose to limit the size of the
echo Windows partition, you will be asked what size to make that partition and another partition will be created that
echo will occupy any space left on the drive. You can use that partition for anything you want.
echo.
choice /c YN /n /m "Limit the size of the Windows partition? Press Y for YES or N for NO:"
if errorlevel 2 set LimitWinParSize=N & goto CommonInfo
if errorlevel 1 set LimitWinParSize=Y & goto LimitSize

:LimitSize

cls
set /p WinParSize="Enter the size in MB to make the Windows partition: "

:: We will now begin to gather the information common to both BIOS and UEFI systems.

:CommonInfo

:: The information gathered from the user in this section applies to both BIOS and UEFI based systems.

:GetWinReParSize

cls
echo Enter the size in MB to make the Windows Recovery Environment (WinRE) partition. You should make this a minimum of
echo 750 MB but it is suggested to use 1000 MB if you can afford the space. I typically use 2000 MB because Microsoft
echo seems to have been increasing the amount of space used in this partition lately.
echo.
set /p WinReParSize="Enter the size in MB to make the Windows Recovery Environment partition: "

:GetDiskId

cls
echo On the next screen you will be asked to enter the Disk ID of the disk to which Windows should be installed.
echo.
echo IMPORTANT: The disk number that you specify here will be ERASED when Windows is installed. Do NOT use your running
echo Windows installation to try to determine the disk ID because disk IDs during Windows setup may be different than while
echo running Windows. If you have not already done so, you should follow these steps to determine the correct disk ID:
echo.
echo 1) Create the Windows installation media that you will use to install Windows now. Do NOT include an autounattend.xml
echo    answer file!
echo.
echo 2) Boot from that media.
echo.
echo 3) At the very first static screen, press SHIFT + F10 to open a command prompt.
echo.
echo 4) At the command prompt, run "diskpart".
echo.
echo 5) Once diskpart has started, run the command "list disk". Note the disk ID (disk number) of the disk to which you
echo    will install Windows. If the information shown is not enough to allow you to determine the correct disk, then
echo    select a disk and show details for that disk to get more info. You can do this for as many disks as needed.
echo    EXAMPLE: "select disk 0", then "detail disk".
echo 6) Run "exit" twice to close diskpart and the command prompt.
echo.
echo 7) Reboot the system back into Windows.
echo.
echo IMPORTANT: Once the disk ID is determined, don't add or remove drives as the disk ID may then change!
echo.

pause

cls
set /p DiskId="Enter the disk ID of the disk to which Windows should be installed: "

:BypassRequirements

cls
echo Do you want to bypass the Windows 11 system requirements check?
echo.
echo Note that this option is safe to use even on systems that do meet Windows 11 requirements, it simply will have no
echo effect on those systems. By using this option, you can use the same answer on both systems that meet requirements
echo and on systems that do not meet requirements.
echo.
choice /C YN /N /M "Press Y for YES or N for NO:"
if errorlevel 2 set BypassWinRequirements=N & goto QualityUpdates
if errorlevel 1 set BypassWinRequirements=Y & goto QualityUpdates

:QualityUpdates

cls
echo Do you want to prevent checks for quality updates during Windows installation?
echo.
echo Windows setup can now check for quality updates during Windows setup. This can considerably lengthen the amount of
echo time that it takes to install Windows. If you select YES then we will prevent these checks during setup.
echo.
choice /C YN /N /M "Press Y for YES or N for NO:"
if errorlevel 2 set BypassQualityUpdatesDuringOobe=N & goto GetProdKey
if errorlevel 1 set BypassQualityUpdatesDuringOobe=Y & goto GetProdKey

:GetProdKey

cls
echo We need the generic product key for the edition of Windows that you wish to install. Below are the most commonly
echo used product keys. For other keys, please visit this link:
echo.
echo https://www.elevenforum.com/t/generic-product-keys-to-install-or-upgrade-windows-11-editions.3713/
echo.
echo Windows 10 or 11 Home Single Language:  BT79Q-G7N6G-PGBYW-4YWX6-6F4BT
echo Windows 10 or 11 Home:                  YTMG3-N6DKC-DKB77-7M9GH-8HVX7
echo Windows 10 or 11 Pro:                   VK7JG-NPHTM-C97JM-9MPGT-3V66T
echo.
set /p ProductKey="Enter the Windows product key or press ENTER to use the Win Pro edition key: "

:GetUserLocale
cls
echo Enter the User Locale to be used. Normally you should select "en-US". However, you can instead opt to use "en-001".
echo If you use en-001, you will end up with a very clean Start screen but there are steps that you MUST take after
echo Windows installation has finished. If you use en-001, then perform these steps immediately after Windows installation:
echo.
echo 1) Enable networking so that Windows has access to the Internet. Look at the Start screen. If you see any
echo    "placeholders", that is greyed out areas in places where icons could be placed, then the system has not yet been
echo    able to access the Internet. Correct this now before moving to step 2. Once the placeholders have disappeared
echo    you can move on to step 2.
echo.
echo 2) Open Settings - Time ^& language - Language ^& region. Change "Country or region" to "United States" and change
echo    "Regional format" to "English (United States)".
echo.
choice /C 12 /N /M "Press 1 for en-US or 2 for en-001:"
if errorlevel 2 set UserLocale=en-001 & goto GetName
if errorlevel 1 set UserLocale=en-US & goto GetName

:GetName

cls
echo Enter the user name that you want to use. Note that this is the user name that will be used to create a local
echo Administrator account for you. On the next screen you will be asked for the "Display Name". The display name
echo is a friendly name or full name of the user that is used in places like the lock screen.
echo.
echo EXAMPLE: You might specify "WinUser" as the User Name and "Windows User" as the Display Name.
echo.
set /p Name="Enter the User Name to be created as a local Administrator: "

:GetDisplayName
cls
set /p DisplayName="Enter the User Display Name / Full User Name: "

:GetTimezone

cls
echo Please enter the time zone that this computer will be in. For example, "Central Standard Time". To get a list of valid
echo time zones, run the command "tzutil /L". The second line of each group is the name that you can specify here.
echo.
set /p TimeZone="Enter timezone or press ENTER to use Central Standard Time: "

:GetComputerName

cls
echo Enter the computer name that you want to use or leave blank. If you leave this blank (by just pressing ENTER), then a
echo random name will be assigned and you can change the name after installation. It is recommended to leave this blank to
echo avoid accidentally assigning the same name to multiple machines if you use the same answer file for multiple machines.
echo.
set /p ComputerName="Enter the computer name: "

:: We are done gathering all needed information through interactive mode. We will now
:: continue as if we were running in automatic mode.

:RunAutoMode

::::::::::::::::::::::::::::::::::::::::
:: Answer File Generation Begins Here ::
::::::::::::::::::::::::::::::::::::::::

cls
echo Generating answer file. Please standby...

:: Include this section for both BIOS and UEFI systems:

echo ^<?xml version="1.0" encoding="utf-8"?^> > autounattend.xml
echo ^<unattend xmlns="urn:schemas-microsoft-com:unattend"^> >> autounattend.xml
echo    ^<settings pass="windowsPE"^> >> autounattend.xml
echo        ^<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^> >> autounattend.xml
echo            ^<SetupUILanguage^> >> autounattend.xml
echo                ^<UILanguage^>en-US^</UILanguage^> >> autounattend.xml
echo            ^</SetupUILanguage^> >> autounattend.xml
echo            ^<InputLocale^>en-US^</InputLocale^> >> autounattend.xml
echo            ^<SystemLocale^>en-US^</SystemLocale^> >> autounattend.xml
echo            ^<UILanguage^>en-US^</UILanguage^> >> autounattend.xml
echo            ^<UserLocale^>%UserLocale%^</UserLocale^> >> autounattend.xml
echo        ^</component^> >> autounattend.xml
echo        ^<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^> >> autounattend.xml
echo            ^<ImageInstall^> >> autounattend.xml
echo                ^<OSImage^> >> autounattend.xml
echo                    ^<InstallTo^> >> autounattend.xml
echo                        ^<DiskID^>%DiskId%^</DiskID^> >> autounattend.xml

:: If Windows is being installed on a UEFI system, then set the partition to which Windows should be installed to 3. On a
:: BIOS based system, use partition 2.

if %SystemType%==UEFI (
set InstallPar=3
) else (
set InstallPar=2
)

echo                        ^<PartitionID^>%InstallPar%^</PartitionID^> >> autounattend.xml
echo                    ^</InstallTo^> >> autounattend.xml
echo                    ^<Compact^>false^</Compact^> >> autounattend.xml
echo                ^</OSImage^> >> autounattend.xml
echo            ^</ImageInstall^> >> autounattend.xml
echo            ^<UserData^> >> autounattend.xml

:: Use product key for version to be installed

echo                ^<ProductKey^> >> autounattend.xml
echo                    ^<Key^>%ProductKey%^</Key^> >> autounattend.xml
echo                ^</ProductKey^> >> autounattend.xml
echo                ^<AcceptEula^>true^</AcceptEula^> >> autounattend.xml
echo            ^</UserData^> >> autounattend.xml

:: Create the RunSynchronous block to allow us to run specific commands

:: NOTE: The "Order" specified for commands run here must be in order (1, 2, 3, etc.). Skipping numbers is not
:: permitted. To facilitate this, we will set a counter with an initial value of 1. After each command we increment
:: the counter by 1.

set /A Phase1CommandCounter=1

echo            ^<RunSynchronous^> >> autounattend.xml

If %BypassWinRequirements%==N goto BypassRequirementsDone

:: These commands bypass Win 11 requirements

echo                ^<RunSynchronousCommand wcm:action="add"^> >> autounattend.xml
echo                    ^<Order^>%Phase1CommandCounter%^</Order^> >> autounattend.xml
echo                    ^<Path^>reg add HKLM\System\Setup\LabConfig /v BypassTPMCheck /t reg_dword /d 0x00000001 /f^</Path^> >> autounattend.xml
echo                ^</RunSynchronousCommand^> >> autounattend.xml

set /A Phase1CommandCounter +=1

echo                ^<RunSynchronousCommand wcm:action="add"^> >> autounattend.xml
echo                    ^<Order^>%Phase1CommandCounter%^</Order^> >> autounattend.xml
echo                    ^<Path^>reg add HKLM\System\Setup\LabConfig /v BypassSecureBootCheck /t reg_dword /d 0x00000001 /f^</Path^> >> autounattend.xml
echo                ^</RunSynchronousCommand^> >> autounattend.xml

set /A Phase1CommandCounter +=1

echo                ^<RunSynchronousCommand wcm:action="add"^> >> autounattend.xml
echo                    ^<Order^>%Phase1CommandCounter%^</Order^> >> autounattend.xml
echo                    ^<Path^>reg add HKLM\System\Setup\LabConfig /v BypassRAMCheck /t reg_dword /d 0x00000001 /f^</Path^> >> autounattend.xml
echo                ^</RunSynchronousCommand^> >> autounattend.xml

set /A Phase1CommandCounter +=1

:BypassRequirementsDone

:: Do these steps for UEFI systems

:: This command performs all the disk setup operations for UEFI based systems only if user wants to limit the size of
:: the Windows partition. We skip this for BIOS based systems.

if %SystemType%==BIOS goto BiosPartitioning
if %LimitWinParSize%==N goto CreateFullSizeWinPar

echo                ^<RunSynchronousCommand wcm:action="add"^> >> autounattend.xml
echo                    ^<Order^>%Phase1CommandCounter%^</Order^> >> autounattend.xml
echo                    ^<Path^>cmd /c (for %%a in ("sel dis %DiskId%" "cle" "con gpt" "cre par efi size=%EfiParSize%" "for quick fs=fat32" "cre par msr size=%MsrParSize%" "cre par pri size=%WinParSize%" "format quick fs=ntfs label="Windows"" "cre par pri size=%WinReParSize%" "for quick fs=ntfs" "set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac" "gpt attributes=0x8000000000000001" "create partition primary" "format quick fs=ntfs") do @echo %%~a) ^&gt; X:\UEFI.txt ^&amp; diskpart /s X:\UEFI.txt^</Path^> >> autounattend.xml
echo                ^</RunSynchronousCommand^> >> autounattend.xml

set /A Phase1CommandCounter +=1

:: This was the last command to be run so we can close out the RunSynchronous block

echo            ^</RunSynchronous^> >> autounattend.xml

goto DonePartitioning

:CreateFullSizeWinPar

echo                ^<RunSynchronousCommand wcm:action="add"^> >> autounattend.xml
echo                    ^<Order^>%Phase1CommandCounter%^</Order^> >> autounattend.xml
echo                    ^<Path^>cmd /c (for %%a in ("sel dis %DiskId%" "cle" "con gpt" "cre par efi size=%EfiParSize%" "for quick fs=fat32" "cre par msr size=%MsrParSize%" "cre par pri" "shr minimum=%WinReParSize%" "for quick fs=ntfs label="Windows"" "cre par pri" "for quick fs=ntfs" "set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac" "gpt attributes=0x8000000000000001") do @echo %%~a) ^&gt; X:\UEFI.txt ^&amp; diskpart /s X:\UEFI.txt^</Path^> >> autounattend.xml
echo                ^</RunSynchronousCommand^> >> autounattend.xml

set /A Phase1CommandCounter +=1

:: This was the last command to be run so we can close out the RunSynchronous block

echo            ^</RunSynchronous^> >> autounattend.xml

goto DonePartitioning

:BiosPartitioning

:: This was the last command to be run so we can close out the RunSynchronous block

echo            ^</RunSynchronous^> >> autounattend.xml

:: These are the operations needed to setup the drive for a BIOS based system.

echo            ^<DiskConfiguration^> >> autounattend.xml
echo                ^<Disk wcm:action="add"^> >> autounattend.xml
echo                    ^<CreatePartitions^> >> autounattend.xml
echo                        ^<CreatePartition wcm:action="add"^> >> autounattend.xml
echo                            ^<Order^>1^</Order^> >> autounattend.xml
echo                            ^<Size^>%WinReParSize%^</Size^> >> autounattend.xml
echo                            ^<Type^>Primary^</Type^> >> autounattend.xml
echo                        ^</CreatePartition^> >> autounattend.xml
echo                        ^<CreatePartition wcm:action="add"^> >> autounattend.xml
echo                            ^<Extend^>true^</Extend^> >> autounattend.xml
echo                            ^<Order^>2^</Order^> >> autounattend.xml
echo                            ^<Type^>Primary^</Type^> >> autounattend.xml
echo                        ^</CreatePartition^> >> autounattend.xml
echo                    ^</CreatePartitions^> >> autounattend.xml
echo                    ^<ModifyPartitions^> >> autounattend.xml
echo                        ^<ModifyPartition wcm:action="add"^> >> autounattend.xml
echo                            ^<Active^>true^</Active^> >> autounattend.xml
echo                            ^<Format^>NTFS^</Format^> >> autounattend.xml
REM echo                            ^<Label^>System^</Label^> >> autounattend.xml
echo                            ^<Order^>1^</Order^> >> autounattend.xml
echo                            ^<PartitionID^>1^</PartitionID^> >> autounattend.xml
echo                        ^</ModifyPartition^> >> autounattend.xml
echo                        ^<ModifyPartition wcm:action="add"^> >> autounattend.xml
echo                            ^<Format^>NTFS^</Format^> >> autounattend.xml
echo                            ^<Label^>Windows^</Label^> >> autounattend.xml
echo                            ^<Letter^>C^</Letter^> >> autounattend.xml
echo                            ^<Order^>2^</Order^> >> autounattend.xml
echo                            ^<PartitionID^>2^</PartitionID^> >> autounattend.xml
echo                        ^</ModifyPartition^> >> autounattend.xml
echo                    ^</ModifyPartitions^> >> autounattend.xml
echo                    ^<DiskID^>0^</DiskID^> >> autounattend.xml
echo                    ^<WillWipeDisk^>true^</WillWipeDisk^> >> autounattend.xml
echo                ^</Disk^> >> autounattend.xml
echo            ^</DiskConfiguration^> >> autounattend.xml

:DonePartitioning

echo        ^</component^> >> autounattend.xml
echo    ^</settings^> >> autounattend.xml
echo    ^<settings pass="oobeSystem"^> >> autounattend.xml
echo        ^<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^> >> autounattend.xml
echo            ^<InputLocale^>en-US^</InputLocale^> >> autounattend.xml
echo            ^<SystemLocale^>en-US^</SystemLocale^> >> autounattend.xml
echo            ^<UILanguage^>en-US^</UILanguage^> >> autounattend.xml

REM Set the proper UserLocale setting:

echo            ^<UserLocale^>%UserLocale%^</UserLocale^> >> autounattend.xml

echo        ^</component^> >> autounattend.xml
echo        ^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^> >> autounattend.xml
echo            ^<OOBE^> >> autounattend.xml
echo                ^<HideEULAPage^>true^</HideEULAPage^> >> autounattend.xml
echo                ^<HideOEMRegistrationScreen^>true^</HideOEMRegistrationScreen^> >> autounattend.xml
echo                ^<HideOnlineAccountScreens^>true^</HideOnlineAccountScreens^> >> autounattend.xml
echo                ^<HideWirelessSetupInOOBE^>true^</HideWirelessSetupInOOBE^> >> autounattend.xml
echo                ^<ProtectYourPC^>1^</ProtectYourPC^> >> autounattend.xml
echo                ^<UnattendEnableRetailDemo^>false^</UnattendEnableRetailDemo^> >> autounattend.xml
echo            ^</OOBE^> >> autounattend.xml
echo            ^<UserAccounts^> >> autounattend.xml
echo                ^<LocalAccounts^> >> autounattend.xml
echo                    ^<LocalAccount wcm:action="add"^> >> autounattend.xml

:: Using a password of "Password1"

echo                        ^<Password^> >> autounattend.xml
echo                            ^<Value^>Password1^</Value^> >> autounattend.xml
echo                            ^<PlainText^>true^</PlainText^> >> autounattend.xml
echo                        ^</Password^> >> autounattend.xml

:: Create the local user account and make a part of the Administrators group.

echo                        ^<DisplayName^>%DisplayName%^</DisplayName^> >> autounattend.xml
echo                        ^<Group^>Administrators^</Group^> >> autounattend.xml
echo                        ^<Name^>%Name%^</Name^> >> autounattend.xml
echo                    ^</LocalAccount^> >> autounattend.xml
echo                ^</LocalAccounts^> >> autounattend.xml
echo            ^</UserAccounts^> >> autounattend.xml

:: Set the time zone

echo            ^<TimeZone^>%TimeZone%^</TimeZone^> >> autounattend.xml

:: Add a registry entry to resolve a bug related to autologon. This answer file will autologon just one time in order
:: to complete Windows setup. Later in this answer file you will see where we specify a logon count of 1. The bug is
:: that Windows will autologon one time more than specified. So, you would think that you could specify zero and that
:: this would result in one logon. Unfortunately, the system does properly understand that zero means nerver logon. The
:: registry entry works around this bug.

:: Set a counter called FirstLogonCommandCounter to keep track of the order of commands. We will set the initial value
:: to 1 and increment each time a command is added.

set /A FirstLogonCommandCounter=1

echo            ^<FirstLogonCommands^> >> autounattend.xml
echo                ^<SynchronousCommand wcm:action="add"^> >> autounattend.xml
echo                    ^<CommandLine^>reg add ^&quot;HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon^&quot; /v AutoLogonCount /t REG_DWORD /d 0 /f^</CommandLine^> >> autounattend.xml
echo                    ^<Order^>%FirstLogonCommandCounter%^</Order^> >> autounattend.xml
echo                ^</SynchronousCommand^> >> autounattend.xml

set /A FirstLogonCommandCounter+=1

:: Use below command only if bypassing quality updates during setup

if %BypassQualityUpdatesDuringOobe%==N goto DoneWithQualityUpdates

echo                ^<SynchronousCommand wcm:action="add"^> >> autounattend.xml
echo                    ^<Order^>%FirstLogonCommandCounter%^</Order^> >> autounattend.xml
echo                    ^<CommandLine^>powershell.exe -Command ^&quot;Get-NetAdapter ^| ForEach-Object { Enable-NetAdapter -Name $_.Name -Confirm:$false }^&quot;^</CommandLine^> >> autounattend.xml
echo                ^</SynchronousCommand^> >> autounattend.xml

set /A %FirstLogonCommandCounter%+=1

:DoneWithQualityUpdates

:: Setup is not fully completed until the user logs on for the first time. We are setting a one-time automatic logon.

echo            ^</FirstLogonCommands^> >> autounattend.xml
echo            ^<AutoLogon^> >> autounattend.xml
echo                ^<Password^> >> autounattend.xml
echo                    ^<Value^>Password1^</Value^> >> autounattend.xml
echo                    ^<PlainText^>true^</PlainText^> >> autounattend.xml
echo                ^</Password^> >> autounattend.xml
echo                ^<Username^>%Name%^</Username^> >> autounattend.xml
echo                ^<Enabled^>true^</Enabled^> >> autounattend.xml
echo                ^<LogonCount^>1^</LogonCount^> >> autounattend.xml
echo            ^</AutoLogon^> >> autounattend.xml
echo        ^</component^> >> autounattend.xml
echo    ^</settings^> >> autounattend.xml

:: Start the Specialize pass

echo    ^<settings pass="specialize"^> >> autounattend.xml
echo        ^<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^> >> autounattend.xml

:: Set the computer name. If name was not provided, then a random name is assigned.

echo            ^<ComputerName^>%ComputerName%^</ComputerName^> >> autounattend.xml

:: Set the time zone

echo            ^<TimeZone^>%TimeZone%^</TimeZone^> >> autounattend.xml

:: Create the Windows Deployment section

echo        ^</component^> >> autounattend.xml
echo        ^<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"^> >> autounattend.xml

:: Use a command to bypass quality updates during setup. Use another command to prevent auto device encryption.
:: First, we create the RunSynchronous block so that we can add those commands.

echo            ^<RunSynchronous^> >> autounattend.xml

:: Create a counter called Phase4CommandCounter to keep trackof command numbers. Increment every
:: time a command is added.

set /A Phase4CommandCounter=1

:: This command disables networking so that quality updates cannot be installed during setup. As a result, add it only
:: if quality updates are being bypassed.

:: For the "if" statements below, the order is important. If system type is specified as BIOS but we check the 2nd if
:: statement first, this would cause an error because the variable that we are checking is empty causing an error.

if %SystemType%==BIOS goto DeviceEncryption
if %BypassQualityUpdatesDuringOobe%==N goto DeviceEncryption

echo                ^<RunSynchronousCommand wcm:action="add"^> >> autounattend.xml
echo                    ^<Order^>%Phase4CommandCounter%^</Order^> >> autounattend.xml
echo                    ^<Path^>powershell.exe -Command ^&quot;Get-NetAdapter ^| ForEach-Object { Disable-NetAdapter -Name $_.Name -Confirm:$false }^&quot;^</Path^> >> autounattend.xml
echo                ^</RunSynchronousCommand^> >> autounattend.xml

set /A Phase4CommandCounter+=1

:DeviceEncryption

:: This command bypasses automatic device encryption. Add it only if user elected to bypass device encryption.

:: For the "if" statements below, the order is important. If system type is specified as BIOS but we check the 2nd if
:: statement first, this would cause an error because the variable that we are checking is empty causing an error.

if %SystemType%==BIOS goto DevEncryptDone
if %BypassDeviceEncryption%==N goto DevEncryptDone

echo                ^<RunSynchronousCommand wcm:action="add"^> >> autounattend.xml
echo                    ^<Order^>%Phase4CommandCounter%^</Order^> >> autounattend.xml
echo                    ^<Path^>reg add HKLM\System\CurrentControlSet\Control\BitLocker /v PreventDeviceEncryption /t reg_dword /d 0x00000001 /f^</Path^> >> autounattend.xml
echo                ^</RunSynchronousCommand^> >> autounattend.xml

set /A Phase4CommandCounter+=1

:DevEncryptDone

:: Close the RunSynchronous block

echo            ^</RunSynchronous^> >> autounattend.xml

:: Close everything else.

echo        ^</component^> >> autounattend.xml
echo    ^</settings^> >> autounattend.xml
echo ^</unattend^> >> autounattend.xml

:END

cls
echo All operations have finished. Press any key to exit.
echo.
pause
exit

:::::::::::::::::::::::::
:: END OF MAIN PROGRAM ::
:::::::::::::::::::::::::


:::::::::::::::
:: FUNCTIONS ::
:::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The following is a function that can be called to convert ::
:: the contents of a variable to uppercase characters.       ::
::                                                           ::
:: To use this function, call this function and pass it the  ::
:: name of the variable to convert. In the example below we  ::
:: are passing "str" as the variable name.                   ::
::                                                           ::
:: Example: call ::TOUPPERCASE str                           ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:TOUPPERCASE
if not defined %~1 exit /b
for %%a in ("a=A" "b=B" "c=C" "d=D" "e=E" "f=F" "g=G" "h=H" "i=I" "j=J" "k=K" "l=L" "m=M" "n=N" "o=O" "p=P" "q=Q" "r=R" "s=S" "t=T" "u=U" "v=V" "w=W" "x=X" "y=Y" "z=Z" "ä=Ä" "ö=Ö" "ü=Ü") do (
call set %~1=%%%~1:%%~a%%
)
goto :eof


::::::::::::::::::::::
:: END OF FUNCTIONS ::
::::::::::::::::::::::



:::::::::::::::::::::
:: Version history ::
:::::::::::::::::::::

:: Version 1.0.0.1 - Aug 19, 2025
:: Initial release
::
:: Version 1.0.1.2 - Aug 24, 2025
:: Corrected some spelling errors, reworded text in a few places for greater clarify, a few other very minor tweaks.
 

My Computers My Computers

  • At a glance

    Win11 Pro 25H2 (RTM+)Intel i7-14650HX32 GBNo GPU - Built-in Intel Graphics
    OS
    Win11 Pro 25H2 (RTM+)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Acemagic
    CPU
    Intel i7-14650HX
    Memory
    32 GB
    Graphics Card(s)
    No GPU - Built-in Intel Graphics
    Sound Card
    Integrated
    Monitor(s) Displays
    Varies as machine will often be moved to locations with different monitors
    Screen Resolution
    Varies
    Hard Drives
    1 x 1TB Gen 4 NVMe SSD
    PSU
    120W Power Brick
    Keyboard
    Corsair K70 Max RGB Magnetic Keyboard
    Mouse
    Logitech MX Master 3
    Internet Speed
    1Gb Up / 1 Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
  • At a glance

    Win11 Pro 25H2 (RTM+)Intel i7-1255U16 GBIntel Iris Xe Graphics
    Operating System
    Win11 Pro 25H2 (RTM+)
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo ThinkBook 13x Gen 2
    CPU
    Intel i7-1255U
    Memory
    16 GB
    Graphics card(s)
    Intel Iris Xe Graphics
    Sound Card
    Realtek® ALC3306-CG codec
    Monitor(s) Displays
    13.3-inch IPS Display
    Screen Resolution
    WQXGA (2560 x 1600)
    Hard Drives
    2 TB 4 x 4 NVMe SSD
    PSU
    USB-C / Thunderbolt 4 Power / Charging
    Keyboard
    Backlit, spill resistant keyboard
    Mouse
    Buttonless Glass Precision Touchpad
    Internet Speed
    1Gb Up / 1Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
    Other Info
    WiFi 6e / Bluetooth 5.1 / Facial Recognition / Fingerprint Sensor / ToF (Time of Flight) Human Presence Sensor
I don't like debugging Schneegan's answer files, because it's machine-generated XML and if you're the developer, you should provide an accessible way for users to provide bug feedback whenever it doesn't work.

Setup will ignore the autounattend file if it finds something objectionable in the XML. There are no BIOS settings which break it, since it's running from inside WinPE and not from normal Windows. My experience is when you have XML-related issues (not necessarily in the syntax, but also the XML block contents), Setup is terrible about providing any actionable feedback in the setup logs.

1. To determine if 24H2 has a compatibility issue with the answer file, perform a test run with any W11 ISO which isn't 24H2 (21H2 thru 23H2).

2. If any W11 except 24H2 works, then my suggestion is to force 24H2's boot.wim to use the legacy Setup client by default. A number of users have confirmed that switching to the legacy Setup tends to fix autounattend file issues.

Mount the boot.wim and apply these changes:
Code:
DISM /Mount-Wim /wimfile:D:\path\to\boot.wim /index:2 /mountdir:C:\Mount
reg load HKLM\TEMP C:\Mount\Windows\System32\config\SYSTEM
reg add HKLM\TEMP\Setup /v "CmdLine" /t REG_SZ /d "X:\\sources\\setup.exe" /f
reg unload HKLM\TEMP
DISM /Unmount-Wim /mountdir:C:\Mount /commit
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
I created the boot stick with the media creation tool from Microsoft. So there's not much special config made. It's only one partition on the stick and formatted as FAT32. The answer file is directly on the root drive.
It's setting basic preferences and preventing to install most bloatware, also setting up a local user account.

I attached the file below, I didn't edit anything myself (just changed the username for uploading it here). If there were an error with the syntax or anything like that, it wouldn't have worked on my Laptop though, would it?

Thank you for the batch, I'll try it and give you feedback right away.
 

Attachments

My Computer My Computer

At a glance

Windows 11AMD Ryzen 9800x3D64 GB Kingston Fury DDR5-6000AMD Radeon RX 7900 XTX
OS
Windows 11
Computer type
PC/Desktop
CPU
AMD Ryzen 9800x3D
Motherboard
ASUS ROG STRIX X670E-F
Memory
64 GB Kingston Fury DDR5-6000
Graphics Card(s)
AMD Radeon RX 7900 XTX
Back
Top Bottom