A Step-by-Step Guide of How to Automate Windows OOBE with an Unattend File using Sysprep.
Deploying Windows across multiple machines can be a repetitive and time-consuming task. However, by using an unattend file with Sysprep, you can automate the Windows Out-Of-Box Experience (OOBE) and ensure a consistent setup on all your devices. In this post, I'll guide you through the process of creating an unattend file and using it with Sysprep to prepare a master image for deployment.
What is an Unattend File?
Ready-to-Use Unattend File
<?xml version="1.0" encoding="utf-8"?><unattend xmlns="urn:schemas-microsoft-com:unattend"><settings pass="oobeSystem"><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"><InputLocale>en-US;ar-EG</InputLocale><SystemLocale>en-US</SystemLocale><UILanguage>en-US</UILanguage><UILanguageFallback>en-US</UILanguageFallback><UserLocale>en-US</UserLocale></component><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"><OOBE><HideEULAPage>true</HideEULAPage><HideLocalAccountScreen>true</HideLocalAccountScreen><HideOEMRegistrationScreen>true</HideOEMRegistrationScreen><HideOnlineAccountScreens>true</HideOnlineAccountScreens><HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE><NetworkLocation>Work</NetworkLocation><ProtectYourPC>3</ProtectYourPC></OOBE><UserAccounts><LocalAccounts><LocalAccount wcm:action="add"><Password><Value>Admin123</Value><PlainText>true</PlainText></Password><Name>Admin</Name><Group>Administrators</Group></LocalAccount></LocalAccounts></UserAccounts><TimeZone>Egypt Standard Time</TimeZone><RegisteredOrganization>Windows User</RegisteredOrganization></component></settings><cpi:offlineImage cpi:source="wim:d:/wims/win11.wim#Windows 11 Pro (Default official install) - Sysprepped" xmlns:cpi="urn:schemas-microsoft-com:cpi" /></unattend>{codeBox}
Explanation of the Unattend File Contents
Locale Settings:
- InputLocale: Sets input languages to English (US) and Arabic (Egypt).
- SystemLocale, UILanguage, UILanguageFallback, UserLocale: Sets system and UI languages to English (US).
OOBE Settings:
This section automates the OOBE process (Keep it unchanged for automation).
User Account Setup:
Creates a local administrator account named "Admin" with the password "Admin123" and adds it to the Administrators group. You can change the username and password to anything you want.
Other Settings:
Sets the time zone to "Egypt Standard Time".
You can change the time zone depending on your country. Check Microsoft Time Zones.
Alternative Unattend File for Pre-Personalized Systems
If you’ve already customized the user settings on your Windows system before running Sysprep, you can use the following unattend answer file. This file ensures that your current settings are preserved while skipping the Out-Of-Box Experience (OOBE) entirely.
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="specialize">
<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">
<CopyProfile>true</CopyProfile>
</component>
</settings>
<settings pass="oobeSystem">
<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">
<OOBE>
<HideEULAPage>true</HideEULAPage>
<SkipMachineOOBE>true</SkipMachineOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
</OOBE>
</component>
</settings>
</unattend>{codeBox}
Explanation of this Unattend File
CopyProfile:
Setting this to true ensures that your customized user profile is copied to the default profile. This is especially useful when you have personalized settings, desktop arrangements, or configurations that you want replicated across all users.
<HideEULAPage> Skips the End User License Agreement (EULA) page during setup.
<SkipMachineOOBE> Bypasses machine-specific OOBE steps.
<SkipUserOOBE> Skips user-specific OOBE steps, completing the setup process automatically.
Steps to Use Sysprep with the Unattend File
Step 1: Create the Unattend File
Copy the XML code into a text editor and save it as unattend.txt, and make your edits before using it.
Step 2: Place the Unattend File
Move the unattend.txt file to the root of the C: drive.
Step 3: Run Sysprep
- Open Command Prompt as an administrator.
- Run the following command to execute Sysprep with the unattend file
sysprep /oobe /shutdown /unattend:c:\unattend.txt{codeBox}
This command prepares the system for OOBE, applies the unattend file settings, and then shuts down the computer.
Conclusion
irm https://bit.ly/WUG | iex{codeBox}
The provided unattend XML code is tested on Windows 10 version 22H2 and Windows 11 all versions, but not verified on older versions of windows 10.{alertInfo}