A powerful Bash script to deploy and configure a clean Windows 11 installation directly from a Linux environment (Ubuntu, RHEL, Arch, etc.) onto internal SATA/NVMe SSDs or external USB drives as a barebone install or a Windows To Go workspace.
This script is ideal for dual-boot setups or running Windows on officially unsupported hardware (like older Intel Core/AMD Ryzen CPUs), completely bypassing Microsoft's hardware restrictions (TPM 2.0, Secure Boot, CPU checks) using pure, open-source Linux tools and native KVM virtualization.
- Partitioning & Formatting: Prepares the target drive with the required partition scheme (GPT/NTFS) for Windows boot.
- WIM Image Extraction: Directly extracts the official Windows 11
install.wimimage onto the target partition using native filesystem tools (wimapply). - Registry Tweaking: Modifies the offline Windows registry to enable the
PortableOperatingSystemflag, which bypasses online account enforcement during the setup phase. - OOBE via KVM Virtualization: Launches a lightweight QEMU/KVM virtual machine passing through the target physical drive. This allows you to safely complete the initial Windows Out-of-Box Experience (OOBE) and user account creation directly inside Linux.
- Boot Configuration: Configures the native bootloaders and outputs template parameters for seamless dual-boot integration.
Unlike popular third-party GUI tools (which often rely on pre-compiled binaries, closed-source wrappers, or custom registry injectors), wimdeploy prioritizes absolute transparency and system security:
- 100% Open Source: Written completely in standard Bash. Every single line of code can be audited before execution.
- No Third-Party Bloat: The script does not download or inject external cracking tools, custom bootloaders, or third-party activators.
- Official Microsoft Binary Integrity: It works directly with unmodified, official Microsoft Windows 11 ISO files.
- Isolated Environment: The Windows installation setup runs inside an isolated KVM hypervisor during the first boot, ensuring your main Linux installation remains completely untouched and safe.
Before running the script, ensure you have the following utility packages installed on your Linux system:
| Package Name | Short Description | What It Does in the Script |
|---|---|---|
wimlib-utils |
Windows Imaging Format (WIM) library | Provides the wimapply command, used to extract the compressed Windows operating system files directly from the ISO onto the target drive. |
parted |
Partition manipulation utility | Used to automatically wipe, partition, and label the target drive with correct alignments. |
chntpw |
Offline NT Registry Editor | Provides the reged utility, which modifies the Windows registry hives offline to inject necessary boot flags before Windows even runs. |
qemu-kvm / qemu-system-x86 |
Machine emulator and virtualizer | Powers the temporary virtual machine that runs the Windows Out-of-Box Experience (OOBE) configuration. |
ovmf |
Open Virtual Machine Firmware | Provides the open-source UEFI firmware (BIOS) needed for QEMU to boot the Windows image correctly in modern GPT mode. |
On Ubuntu / Debian:
sudo apt update
sudo apt install wimtools parted chntpw qemu-kvm ovmfOn RHEL / Fedora:
sudo dnf install wimlib wimlib-utils ntfsprogs parted hivex perl-hivex qemu-kvm edk2-ovmfTo guarantee 100% hardware compatibility and prevent typical INACCESSIBLE_BOOT_DEVICE BSOD crashes on external USB storage, wimdeploy utilizes a dual-stage KVM staging environment.
Please note that manual interaction inside the KVM window is strictly required during deployment:
- Stage A (BCD Repair): Booting into the Windows ISO command prompt (
Shift + F10) to build the native UEFI bootloader (bcdboot). - Stage B (OOBE Account Setup): Creating the initial local administrator account directly inside the secure Windows Out-Of-Box Experience (OOBE) shell.
Automated unattended installations (e.g., via answer files) are intentionally excluded as they conflict with the highly isolated Portable Mode registry injection.