Background

As part of my exploration into reproducible systems, inspired by my recent work with NixOS, I set out to make my Windows installation more deterministic and automated. My primary goals were to create a debloated Windows 11 installation with unnecessary features disabled and settings optimized and to manage all application installations through a package manager.

Before diving in, I should address why I still use Windows. Despite my preference for Unix-based operating systems, gaming keeps me tethered to the Windows ecosystem. While Valve has made remarkable progress with their Proton compatibility layer, many multiplayer games still require native Windows to function properly.

Approach

The foundation of this automation relies on Microsoft’s Answer files, which allow scripts to be executed during the Windows installation process. I first discovered this technique through this informative YouTube video. While this method works for both Windows 10 and 11, I’ll focus specifically on Windows 11.

For application management, we’ll use Microsoft’s WinGet package manager, providing a streamlined approach to software installation.

Understanding Answer Files

Answer files work through a simple mechanism: create an autounattend.xml file and place it on your Windows installation media. The system automatically executes this file at predetermined points during installation. Rather than diving deep into Microsoft’s Answer File specifications, I built upon this existing implementation from the aforementioned YouTube creator.

After reviewing the original autounattend.xml, I made several modifications to suit my needs, resulting in this customized version. If you’re creating your own answer file, I recommend either starting with an existing template or using this generator.

Leveraging Winget

The Windows package manager landscape includes several options like Chocolatey and Scoop, which I’ve monitored over the years. However, I opted for Microsoft’s official WinGet package manager. You can browse available packages through the convenient winget.run web interface.

To define my desired software stack, I created a winget-packages.json configuration file.

Version Control and Reproducibility

By storing both the autounattend.xml and winget-packages.json files in a version-controlled repository, we can track changes and easily deploy consistent configurations across multiple machines. This approach brings us closer to a truly reproducible system.

Drive Management Strategy

I recommend maintaining separate drives for different purposes: one for the operating system, another for media storage, and potentially a dedicated SSD for games. This separation enables quick operating system reinstallation without risking data on other drives.

Installation Steps

  1. Download Windows 11 (multi-edition ISO for x64 devices) from Microsoft’s official site.
  2. Create installation media USB using MediaCreationTool.exe. (alternatives include using Rufus, Ventoy)
  3. Copy your autounattend.xml to the installation USB (feel free to use my version)
  4. Shut down your computer
  5. [Recommended] Disconnect all drives except the target installation drive
  6. Boot from the USB and follow the installation wizard (you may notice background terminal windows as the answer file executes)
  7. After installation, shut down, remove the USB, reconnect any disconnected drives, and restart
  8. During first boot, you may see additional terminal windows as final configurations are applied
  9. Open Command Prompt and run winget import [path to winget-packages.json] to install your predefined software suite

Conclusion

This automated approach to Windows 11 installation, combining Answer Files and WinGet, provides a repeatable and efficient way to deploy a clean, customized system. The process minimizes manual intervention while ensuring consistent configurations across installations.