Automating Windows 11 deployments on Azure Virtual Desktop (AVD) often involves handling the Out-of-Box Experience (OOBE), which can interrupt unattended image builds. OOBE is the initial setup process that prompts for user input, such as region, language, and privacy settings. Skipping OOBE during a Packer build speeds up image provisioning and ensures the virtual machine is ready for configuration scripts and application installations without manual intervention.
Automating OOBE Bypass with Unattend.xml
Step 1: Prepare an Unattend.xml
answer file. This XML file provides responses to Windows setup prompts, allowing the build to proceed without manual input. The most critical section for bypassing OOBE is the oobeSystem
configuration pass. Here’s a minimal example:
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="oobeSystem">
<component name="Microsoft-Windows-International-Core">
<InputLocale>en-US</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UserLocale>en-US</UserLocale>
</component>
<component name="Microsoft-Windows-Shell-Setup">
<OOBE>
<HideEULAPage>true</HideEULAPage>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>3</ProtectYourPC>
<HideLocalAccountScreen>true</HideLocalAccountScreen>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
</OOBE>
<UserAccounts>
<AdministratorPassword>
<Value>YourSecurePassword123!</Value>
<PlainText>true</PlainText>
</AdministratorPassword>
</UserAccounts>
<RegisteredOrganization>YourOrg</RegisteredOrganization>
<RegisteredOwner>YourOwner</RegisteredOwner>
<TimeZone>UTC</TimeZone>
<AutoLogon>
<Username>Administrator</Username>
<Password>
<Value>YourSecurePassword123!</Value>
<PlainText>true</PlainText>
</Password>
<Enabled>true</Enabled>
</AutoLogon>
</component>
</settings>
</unattend>
This file must be customized with your organization’s preferences and credentials. The Hide*
elements suppress various OOBE screens, while AutoLogon
ensures the Administrator account is ready for further provisioning.

Step 2: Integrate the Unattend.xml
file into your Packer build. In your Packer template, use the floppy_files
or boot_command
options to inject the answer file. For example, in the builders
section:
"floppy_files": [
"autounattend.xml"
]
Or, if using the Azure builder, specify the customize
step to copy the file and run sysprep
with the answer file attached.
Step 3: Verify the build process. When the VM boots, Windows Setup will automatically process the Unattend.xml
file and skip the OOBE prompts. The system should reach the desktop or be ready for further provisioning scripts without manual input.
Using Sysprep with OOBE Skip Parameters
Step 1: After installing Windows and required software, run sysprep
with the /oobe
and /unattend
switches to generalize the image and apply your unattended configuration. This removes unique system information and prepares the image for deployment.
sysprep /generalize /oobe /shutdown /unattend:C:\Path\To\Unattend.xml
This command ensures that when the image is deployed, the OOBE screens are bypassed as specified in your answer file.

Step 2: Capture the image for use in Azure Virtual Desktop. Once sysprep completes and the VM shuts down, proceed with the image capture process appropriate for your Packer workflow or Azure environment.
Disabling OOBE via Registry or Command Line (Temporary Workarounds)
Some administrators use registry edits or command-line switches to suppress OOBE. These workarounds are less robust and may not remain supported in future Windows versions.
Step 1: Add a command to set the SkipMachineOOBE
and SkipUserOOBE
registry values:
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\OOBE" /v SkipMachineOOBE /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\OOBE" /v SkipUserOOBE /t REG_DWORD /d 1 /f

Step 2: Reboot the VM. Windows may skip OOBE screens, but this method does not guarantee all setup steps are bypassed, and is not recommended for production images.
Using an Unattend.xml
file with Packer reliably bypasses OOBE during Windows 11 image builds for AVD. This approach streamlines automated deployments and minimizes manual setup time, letting you focus on further configuration and application provisioning.
Member discussion