An automated, end-to-end PowerShell utility designed to create a customized, bootable Windows 11 installation USB. This script downloads a base Windows image, clones the drivers from the active host machine, injects them into the installation media, and prepares a Secure Boot-compliant USB drive.
Ideal for system administrators, IT professionals, and hardware enthusiasts looking to automate deployment and create "self-replicating" installation media tailored to a specific hardware profile.
- Host Driver Cloning (
Export-WindowsDriver): Automatically extracts all third-party drivers (Network, Audio, Chipset, GPU) currently running on the host machine. - Automated DISM Injection: Handles the mounting, injection, and committing of drivers into the Windows Image (
install.wim/install.esd) seamlessly. - Intelligent Image Conversion: Detects compressed
.esdfiles and natively converts them to editable.wimformats on the fly. - Secure Boot Revocation Fix (EFI Transplant): Replaces older, potentially revoked bootloaders (
bootx64.efi) in the ISO with the healthy, signed bootloader from the active host OS. This prevents the "Security Violation" red screen in Rufus or native boot setups. - Automated USB Provisioning: Detects removable drives, formats them to UEFI-required FAT32, and handles the file transfer automatically.
- Large File Splitting (
.swm): Automatically detects if the customizedinstall.wimexceeds the 4GB FAT32 file size limit and uses DISM to split the image into smaller.swmchunks for seamless Windows Setup integration.
- Operating System: Windows 10 or Windows 11.
- Privileges: Must be executed in an Elevated PowerShell Session (Run as Administrator).
- Storage Space: At least 20GB of free space on the
C:\drive for the temporary staging area (C:\Temp\Win11_Build). - USB Flash Drive: An empty USB drive (8GB minimum, 16GB+ recommended). All data on the selected drive will be destroyed.
- Workspace Prep: Cleans up previous incomplete mounts and builds a fresh directory structure in
C:\Temp. - Driver Export: Scans the live system and exports all active
.infdrivers to a staging folder. - Media Acquisition: Prompts the user to provide the base Windows 11 ISO.
- Extraction & Conversion: Mounts the ISO, copies the contents, and converts
install.esdtoinstall.wimif necessary. - Driver Injection: Uses DISM to mount the WIM index and inject the exported drivers via
/ForceUnsigned. - Bootloader Sanitization: Copies the host machine's
bootmgfw.efito the staging media, ensuring the final USB passes Secure Boot checks. - USB Formatting: Lists available USB drives, awaits user confirmation (
DESTROY), and formats the target to FAT32. - WIM Splitting & Transfer: Copies all installation files to the USB. If the
install.wimexceeds 4GB, it splits it into<4GB.swmchunks to comply with FAT32 limitations.
- Download the
Deploy_Win11_USB.ps1script to your local machine. - Right-click the
.ps1file and select Run with PowerShell, OR open an Administrator PowerShell prompt and execute:.\Deploy_Win11_USB.ps1
- A browser window will open to download the base ISO. Once downloaded, drag and drop the ISO file path into the PowerShell console when prompted.
- Follow the on-screen prompts to select the correct Windows Index (Usually
1or6). - When prompted for the USB target, enter the corresponding Disk Number and type
DESTROYto authorize formatting. - Wait for the file transfer and
.swmsplitting to complete.
- Error 0xc1510111 (Read-Only): The script automatically strips the
Read-Onlyattribute from files copied off the virtual ISO to prevent DISM commit failures. - Cross-Hardware Deployment: This script is designed to create media for the machine it was built on (due to the driver cloning). Using the resulting USB on a completely different manufacturer/model may result in missing drivers or blue screens during setup.
This script formats physical disk drives. Ensure you select the correct USB Disk Number when prompted. The author is not responsible for accidental data loss. Always verify your drive selections.
