Use autounattend.xml files to install Windows 10/11

Windows installation instructions

Windows Setup will automatically search for autounattend.xml files at various locations, including the root folders of each removable drive. Therefore, to perform unattended Windows installations, there is no need to use third-party software or to modify .iso or .wim files. Just follow these steps:

To install Windows from a DVD

  1. Fill out the form, then click the button.
  2. Copy the autounattend.xml file to the root folder of a USB drive and connect it to the computer.
  3. Boot from the DVD drive to begin the unattended installation.

To install Windows from a USB drive

  1. Fill out the form, then click the button.
  2. Make a bootable USB drive that contains the Windows Setup files, either with Microsoft's Media Creation Tool or by copying an .iso image to the USB drive.
  3. Copy the autounattend.xml file to the root folder of the USB drive and connect it to the computer.
  4. Boot from the USB drive to begin the unattended installation.

To install Windows on a virtual machine in VMware Workstation

  1. Fill out the form, make sure to check Install VMware Tools, then click the button.
  2. Create your VM. If VMware uses Easy Install, remove the drive where autoinst.flp or autoinst.iso are attached:
  3. Attach the following images to your VM as optical drives:
  4. Start the VM to begin the unattended installation.

To install Windows on a virtual machine in Oracle VirtualBox

  1. Fill out the form, make sure to check Install Oracle VirtualBox Guest Additions, then click the button.
  2. Create your VM. Since we want to use our own autounattend.xml file and not the one provided by VirtualBox, check the Skip Unattended Installation setting:
  3. Attach the following images to your VM as optical drives:
  4. Start the VM to begin the unattended installation.

To install Windows on a virtual machine in Proxmox VE

  1. Fill out the form, make sure to check Install VirtIO Guest Tools and QEMU Guest Agent, then click the button.
  2. Upload these .iso files to Proxmox:
  3. Create your VM and configure its CD/DVD drives as follows:
  4. Start the VM to begin the unattended installation.

To install Windows on a virtual machine in Hyper-V

  1. Fill out the form, then click the button. (Note that there is no option to install the vmguest.iso image because it is no longer needed or included in Hyper-V.)
  2. Create your VM.
  3. Add an additional DVD drive to the VM and attach the unattend.iso image downloaded earlier:
  4. Start the VM to begin the unattended installation.

To install Windows on a virtual machine in Parallels Desktop for Mac

  1. Fill out the form, make sure to check Install Parallels Tools for Parallels Desktop, then click the button.
  2. Attach the following images to your VM as optical drives:
  3. Start the VM to begin the unattended installation.

Using the $OEM$ folder

You can instruct Windows Setup to look for a folder named $OEM$ on your installation medium and recursively copy its contents to the target system during the PE stage. When you use an autounattend.xml file, include the <UseConfigurationSet>true</UseConfigurationSet> element to trigger this behavior. In my generator, checking the Use a distribution share / configuration set option will create this element.

See Microsoft's documentation for how the $OEM$ folder and its subfolders are processed. For example, you could create your installation medium as follows:

During the PE stage, Windows Setup will copy the file in the $OEM$ folder to the target volume, preserving its relative path. Together with the applied Windows image, the C:\ drive would look like this when the installation has finished:

Using the $WinPEDriver$ folder

When you place a folder named $WinPEDriver$ on your installation medium, Windows Setup will recursively scan this folder for .inf files and automatically install the corresponding device drivers during the PE stage.

Driver packages suitable for automatic installation typically contain files with .inf, .sys and .cat extensions. Drivers packaged as .exe files are not suited for this kind of setup, but many vendors offer both types of packages. For example, Intel's Wi-Fi drivers are available as two downloads, namely WiFi-24.20.0-Driver64-Win10-Win11.exe and WiFi-24.20.0-Driver64-Win10-Win11.zip. Only the latter one is suitable for automatic installation.

To automatically install the drivers in the .zip archive, simply unzip it and place its contents in the $WinPEDriver$ folder. The folder structure on your installation medium would then look like this:

Undoing certain customizations

Restore default lock keys behavior

To undo behaviors set through the Lock key settings section, run this command in an elevated PowerShell session:

Remove-ItemProperty -LiteralPath 'Registry::HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layout' -Name 'Scancode Map';

Delete the scheduled task that periodically sets all tray icons visible

To undo the Always show all tray icons setting in Windows 11, run this command in an elevated PowerShell session:

Get-ScheduledTask -TaskName 'ShowAllTrayIcons' | Unregister-ScheduledTask -Confirm:$false;

Disable classic context menu in Windows 11

To undo the Use classic context (right-click) menu in Windows 11 setting, run this command in PowerShell:

Remove-Item -LiteralPath 'Registry::HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32';

Re-enable UAC

To undo the Disable User Account Control (UAC) setting, run this command in an elevated PowerShell session and reboot the computer:

Set-ItemProperty -LiteralPath 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System' -Name 'EnableLUA' -Value 1 -Type 'DWord';

Reset PowerShell execution policy

To undo the Allow execution of PowerShell script files setting, run this command in an elevated PowerShell session:

Set-ExecutionPolicy -Scope 'LocalMachine' -ExecutionPolicy 'Undefined' -Force;

Enable Manage devices button in Settings

When the Disable app suggestions / Content Delivery Manager setting was checked, as a side effect the Manage devices button in the Mobile devices section in Settings is disabled. To enable that button, run this command in an elevated PowerShell session and reboot the computer:

Set-ItemProperty -LiteralPath 'Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CloudContent' -Name 'DisableWindowsConsumerFeatures' -Value 0 -Type 'DWord';

Use PowerShell instead of VBScript to show all tray icons

The scheduled task ShowAllTrayIcons, which periodically sets all tray icons visible, had previously executed VBScript code. VBScript has since been deprecated by Microsoft. To migrate the task from VBScript to PowerShell, run this command in an elevated PowerShell session:

$action = New-ScheduledTaskAction -Execute '%windir%\System32\conhost.exe' -Argument '--headless %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -NoProfile -NonInteractive -Command "Set-ItemProperty -Path ''Registry::HKCU\Control Panel\NotifyIconSettings\*'' -Name ''IsPromoted'' -Value 1 -Type ''DWord'';"';
Set-ScheduledTask -TaskName 'ShowAllTrayIcons' -Action $action;
Remove-Item -LiteralPath "${env:windir}\Setup\Scripts\ShowAllTrayIcons.vbs";

Use PowerShell instead of VBScript to move active hours

The scheduled task MoveActiveHours, which periodically moves your active hours in order to prevent Windows Update from rebooting your computer, had previously executed VBScript code. VBScript has since been deprecated by Microsoft. To migrate the task from VBScript to PowerShell, run this command in an elevated PowerShell session:

$action = New-ScheduledTaskAction -Execute '%windir%\System32\conhost.exe' -Argument '--headless %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -NoProfile -NonInteractive -Command "$p = @{ LiteralPath = ''Registry::HKLM\Software\Microsoft\WindowsUpdate\UX\Settings''; Type = ''DWord''; }; $h = [datetime]::Now.Hour; Set-ItemProperty @p -Name ''ActiveHoursStart'' -Value (($h + 23) % 24); Set-ItemProperty @p -Name ''ActiveHoursEnd'' -Value (($h + 11) % 24); Set-ItemProperty @p -Name ''SmartActiveHoursState'' -Value 2;"';
Set-ScheduledTask -TaskName 'MoveActiveHours' -Action $action;
Remove-Item -LiteralPath "${env:windir}\Setup\Scripts\MoveActiveHours.vbs";

Troubleshooting

autounattend.xml files generated by this service work with any version of Windows 10 and Windows 11, including 24H2 and 25H2, in both ConX and legacy setup modes. When an answer file is not processed as expected, check for the following:

The unattended installation writes error messages and other output to various log files:

Path Stage Contents
  • X:\Windows\setupact.log
  • X:\Windows\setuperr.log
Windows PE Windows Setup logs for PE stage. Inspect these files when Windows Setup does not seem to apply your autounattend.xml file.
  • X:\diskpart.log
Windows PE Output of diskpart script to partition and format your hard drive.
  • C:\Windows\Panther\setupact.log
  • C:\Windows\Panther\setuperr.log
After first reboot Windows Setup logs for all stages after Windows PE. Inspect these files when Windows Setup displays an error message.
  • C:\Windows\Setup\Scripts\Specialize.log
  • C:\Windows\Setup\Scripts\DefaultUser.log
  • C:\Windows\Setup\Scripts\FirstLogon.log
  • %TEMP%\UserOnce.log
After Windows has been installed Output of custom scripts, WLAN setup and various other configuration actions.
  • C:\Windows\Setup\Scripts\RemovePackages.log
  • C:\Windows\Setup\Scripts\RemoveFeatures.log
  • C:\Windows\Setup\Scripts\RemoveCapabilities.log
After Windows has been installed Logs results of bloatware removal.
  • C:\Windows\Setup\Scripts\SetComputerName.log
After Windows has been installed Output of PowerShell script that sets your computer's name.

Security considerations

During Windows Setup, file are created that may contain sensitive data:

Previous versions of the generator did not delete these files. The current version of the generator does delete them, unless the Keep sensitive files checkbox is selected.

Furthermore, files embeddeded in the autounattend.xml file will be extracted to the C:\Windows\Setup\Scripts folder. Check these files when you have entered sensitive data in custom scripts.