Solved Installation of a fresh windows 11 24h2 stop with errors


That’s what I keep reading around the net.
If I wasn't running the Insider builds I would wait for the official release. It's so close to being released to the general public.
 

My Computers

System One System Two

  • OS
    Windows 11 Canary Channel
    Computer type
    PC/Desktop
    Manufacturer/Model
    PowerSpec B746
    CPU
    Intel Core i7-10700K
    Motherboard
    ASRock Z490 Phantom Gaming 4/ax
    Memory
    16GB (8GB PC4-19200 DDR4 SDRAM x2)
    Graphics Card(s)
    NVIDIA GeForce GTX 1050 TI
    Sound Card
    Realtek Audio
    Monitor(s) Displays
    Samsung SAM0A87 Samsung SAM0D32
    Screen Resolution
    1920 x 1080
    Hard Drives
    NVMe WDC WDS100T2B0C-00PXH0 1TB
    Samsung SSD 860 EVO 1TB
    PSU
    750 Watts (62.5A)
    Case
    PowerSpec/Lian Li ATX 205
    Keyboard
    Logitech K270
    Mouse
    Logitech M185
    Browser
    Microsoft Edge and Firefox
    Antivirus
    ESET Internet Security
  • Operating System
    Windows 11 Canary Channel
    Computer type
    PC/Desktop
    Manufacturer/Model
    PowerSpec G156
    CPU
    Intel Core i5-8400 CPU @ 2.80GHz
    Motherboard
    AsusTeK Prime B360M-S
    Memory
    16 MB DDR 4-2666
    Monitor(s) Displays
    23" Speptre HDMI 75Hz
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 970 EVO 500GB NVMe
    Mouse
    Logitek M185
    Keyboard
    Logitek K270
    Browser
    Firefox, Edge and Edge Canary
    Antivirus
    Windows Defender
If I wasn't running the Insider builds I would wait for the official release. It's so close to being released to the general public.
Agreed.

But people want what people want, regardless of the hoops they need to jump through.
I am less an enthusiast than I am needing a computer to make a living and perform tasks.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 23H2 Build 22631.4249
    Computer type
    PC/Desktop
    Manufacturer/Model
    Sin-built
    CPU
    Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (4th Gen?)
    Motherboard
    ASUS ROG Maximus VI Formula
    Memory
    32.0 GB of I forget and the box is in storage.
    Graphics Card(s)
    Gigabyte nVidia GeForce GTX 1660 Super OC 6GB
    Sound Card
    Onboard
    Monitor(s) Displays
    4 x LG 23MP75 - 2 x 24MK430H-B - 1 x Wacom Pro 22" Tablet
    Screen Resolution
    All over the place
    Hard Drives
    Too many to list.
    OS on Samsung 1TB 870 QVO SATA
    PSU
    Silverstone 1500
    Case
    NZXT Phantom 820 Full-Tower Case
    Cooling
    Noctua NH-D15 Elite Class Dual Tower CPU Cooler / 6 x EziDIY 120mm / 2 x Corsair 140mm somethings / 1 x 140mm Thermaltake something / 2 x 200mm Corsair.
    Keyboard
    Corsair K95 / Logitech diNovo Edge Wireless
    Mouse
    Logitech G402 / G502 / Mx Masters / MX Air Cordless
    Internet Speed
    100/40Mbps
    Browser
    All sorts
    Antivirus
    Kaspersky Premium
    Other Info
    I’m on a horse.
  • Operating System
    Windows 11 Pro 23H2 Build: 22631.4249
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO Yoga 7i EVO OLED 14" Touchscreen i5 12 Core 16GB/512GB
    CPU
    Intel Core 12th Gen i5-1240P Processor (1.7 - 4.4GHz)
    Memory
    16GB LPDDR5 RAM
    Graphics card(s)
    Intel Iris Xe Graphics Processor
    Sound Card
    Optimized with Dolby Atmos®
    Screen Resolution
    QHD 2880 x 1800 OLED
    Hard Drives
    M.2 512GB
    Other Info
    …still on a horse.
The issue however seems to be something with the creation of the bootable flash drive installer. The OP was able to do an inplace upgrade without issue. So therein lies the trouble.
 

My Computer

System One

  • OS
    Win 7/10/11
    Computer type
    PC/Desktop
    Other Info
    I'm a computer enthusiast so have quite a few systems that I run. More like an advanced hobby.
I am less an enthusiast than I am needing a computer to make a living and perform tasks.
I come under the category of being an average user. I don't use my computer for work or anything that would be catastrophic if my computers failed. For me it's about the time and effort it would take me to do a clean install and starting over. Knock on wood, The only clean installs I've ever had to do was because I wanted to.There was a few times that I have just swapped my drives from the old computer to my new computers and didn't have to do anything extra to get the computer to run. Because my two desktops are on the Canary Insider Ring, I do weekly backups just in case. Have I ever had to use my images? Yes! The only time my images didn't help was the time I couldn't update my old computer to the latest Insider Build. Restoring a image worked great. I tried three different versions of Windows I had saved and even though the images worked before to update to newer builds, my desktop would not update. A clean install was the only thing that worked. The downside was that I lost all of my Free Software Of The Day programs.
 

My Computers

System One System Two

  • OS
    Windows 11 Canary Channel
    Computer type
    PC/Desktop
    Manufacturer/Model
    PowerSpec B746
    CPU
    Intel Core i7-10700K
    Motherboard
    ASRock Z490 Phantom Gaming 4/ax
    Memory
    16GB (8GB PC4-19200 DDR4 SDRAM x2)
    Graphics Card(s)
    NVIDIA GeForce GTX 1050 TI
    Sound Card
    Realtek Audio
    Monitor(s) Displays
    Samsung SAM0A87 Samsung SAM0D32
    Screen Resolution
    1920 x 1080
    Hard Drives
    NVMe WDC WDS100T2B0C-00PXH0 1TB
    Samsung SSD 860 EVO 1TB
    PSU
    750 Watts (62.5A)
    Case
    PowerSpec/Lian Li ATX 205
    Keyboard
    Logitech K270
    Mouse
    Logitech M185
    Browser
    Microsoft Edge and Firefox
    Antivirus
    ESET Internet Security
  • Operating System
    Windows 11 Canary Channel
    Computer type
    PC/Desktop
    Manufacturer/Model
    PowerSpec G156
    CPU
    Intel Core i5-8400 CPU @ 2.80GHz
    Motherboard
    AsusTeK Prime B360M-S
    Memory
    16 MB DDR 4-2666
    Monitor(s) Displays
    23" Speptre HDMI 75Hz
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 970 EVO 500GB NVMe
    Mouse
    Logitek M185
    Keyboard
    Logitek K270
    Browser
    Firefox, Edge and Edge Canary
    Antivirus
    Windows Defender
Hello everyone,
Why it is still bothering clean install/upgrade to Windows 11 v 24H2 despite meeting all requirements by windows users having latest machine pc hardware? This is happening ever since Windows 11 has been launched by Microsoft.
I have installed / upgraded to Windows 11 v24H2 on my unsupported pc many times irrespective of Windows 11 download from uupdump or Microsoft official website.
Registry bypass is still working on both supported / unsupported pc for installation / upgradation to Windows 11 v24H2.
Creating two partitions FAT32 & NTFS on bootable usb has been working greatly with FAT32 partition having boot.wim in manually created 'sources' folder and NTFS partition having all files and folder on it provided boot.wim moved to FAT32 partition 'sources' folder. This method has been clearly mentioned by our VIP members and by @Brink.
Thanks.
 
Last edited:

My Computer

System One

  • OS
    Window 11 v24H2 Build 26100.2033
    Computer type
    PC/Desktop
    Manufacturer/Model
    ASSEMMBLED
    CPU
    Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz 3.10 GHz
    Motherboard
    ZEBRONICS
    Memory
    4.00 GB (3.89 GB usable)
    Graphics Card(s)
    Onboard
    Sound Card
    Onboard
    Monitor(s) Displays
    LG
    Screen Resolution
    1366x768
    Hard Drives
    Toshiba HDD 1 TB
    Keyboard
    Mechanical
    Mouse
    Mechanical
    Internet Speed
    700 kb/s
    Browser
    Microsoft EDGE, CHROME
    Antivirus
    Microsoft Defender
So, this was my thinking -
Hello everyone,
Why it is still bothering clean install/upgrade to Windows 11 v 24H2 despite meeting all requirements by windows users having latest machine pc hardware? This is happening ever since Windows 11 has been launched by Microsoft.
I have installed / upgraded to Windows 11 v24H2 on my unsupported pc many times irrespective of Windows 11 download from uupdump or Microsoft official website.
Registry bypass is still working on both supported / unsupported pc for installation / upgradation to Windows 11 v24H2.
Creating two partitions FAT32 & NTFS on bootable usb has been working greatly with FAT32 partition having boot.wim in manually created 'sources' folder and NTFS partition having all files and folder on it provided boot.wim moved to FAT32 partition 'sources' folder. This method has been clearly mentioned by our VIP members and by @Brink.
Thanks.
Ramesh, there are many out there who don't perform a clean update ever, or if they do, it may be years between such clean installs. As a result, they may have never come here, at least not to look for advice on performing a clean installation. Also, let's face it, if this is something brand new to you, then surely there would be a lot of confusion. There are SO many threads and so many comments related to clean installation that surely this must be a daunting task, especially for less technically inclined individuals.

Hey, at least it keeps us busy, right? :-)
 

My Computers

System One System Two

  • OS
    Win11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Kamrui Mini PC, Model CK10
    CPU
    Intel i5-12450H
    Memory
    32GB
    Graphics Card(s)
    No GPU - Built-in Intel Graphics
    Sound Card
    Integrated
    Monitor(s) Displays
    HP Envy 32
    Screen Resolution
    2560 x 1440
    Hard Drives
    1 x 2TB NVMe SSD
    1 x 4TB NVMe SSD
    1 x 4TB 2.5" SSD
    PSU
    120W "Brick"
    Keyboard
    Corsair K70 Mechanical Keyboard
    Mouse
    Logitech MX Master 3
    Internet Speed
    1Gb Up / 1 Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
  • Operating System
    Win11 Pro 23H2
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo ThinkBook 13x Gen 2
    CPU
    Intel i7-1255U
    Memory
    16 GB
    Graphics card(s)
    Intel Iris Xe Graphics
    Sound Card
    Realtek® ALC3306-CG codec
    Monitor(s) Displays
    13.3-inch IPS Display
    Screen Resolution
    WQXGA (2560 x 1600)
    Hard Drives
    2 TB 4 x 4 NVMe SSD
    PSU
    USB-C / Thunderbolt 4 Power / Charging
    Mouse
    Buttonless Glass Precision Touchpad
    Keyboard
    Backlit, spill resistant keyboard
    Internet Speed
    1Gb Up / 1Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
    Other Info
    WiFi 6e / Bluetooth 5.1 / Facial Recognition / Fingerprint Sensor / ToF (Time of Flight) Human Presence Sensor
Thanks @hsehestedt,
In my city/district 99% windows users are using preinstalled Windows 11 desktop/laptop pc. (Those who are purchasing desktop/ laptop pc to use windows ) I refer many technicians to use Windows 11, but nobody cares and dares to use Windows 11 on newly assembled desktop pc. They are Windows 10 users.
Again the main question remains unanswered.
Why bootable usb fails to install Windows 11 on pc which meets 100% correct hardware requirements for Windows 11 v24H2?
Thanks.
 

My Computer

System One

  • OS
    Window 11 v24H2 Build 26100.2033
    Computer type
    PC/Desktop
    Manufacturer/Model
    ASSEMMBLED
    CPU
    Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz 3.10 GHz
    Motherboard
    ZEBRONICS
    Memory
    4.00 GB (3.89 GB usable)
    Graphics Card(s)
    Onboard
    Sound Card
    Onboard
    Monitor(s) Displays
    LG
    Screen Resolution
    1366x768
    Hard Drives
    Toshiba HDD 1 TB
    Keyboard
    Mechanical
    Mouse
    Mechanical
    Internet Speed
    700 kb/s
    Browser
    Microsoft EDGE, CHROME
    Antivirus
    Microsoft Defender
99% hey?… Statistics.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 23H2 Build 22631.4249
    Computer type
    PC/Desktop
    Manufacturer/Model
    Sin-built
    CPU
    Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (4th Gen?)
    Motherboard
    ASUS ROG Maximus VI Formula
    Memory
    32.0 GB of I forget and the box is in storage.
    Graphics Card(s)
    Gigabyte nVidia GeForce GTX 1660 Super OC 6GB
    Sound Card
    Onboard
    Monitor(s) Displays
    4 x LG 23MP75 - 2 x 24MK430H-B - 1 x Wacom Pro 22" Tablet
    Screen Resolution
    All over the place
    Hard Drives
    Too many to list.
    OS on Samsung 1TB 870 QVO SATA
    PSU
    Silverstone 1500
    Case
    NZXT Phantom 820 Full-Tower Case
    Cooling
    Noctua NH-D15 Elite Class Dual Tower CPU Cooler / 6 x EziDIY 120mm / 2 x Corsair 140mm somethings / 1 x 140mm Thermaltake something / 2 x 200mm Corsair.
    Keyboard
    Corsair K95 / Logitech diNovo Edge Wireless
    Mouse
    Logitech G402 / G502 / Mx Masters / MX Air Cordless
    Internet Speed
    100/40Mbps
    Browser
    All sorts
    Antivirus
    Kaspersky Premium
    Other Info
    I’m on a horse.
  • Operating System
    Windows 11 Pro 23H2 Build: 22631.4249
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO Yoga 7i EVO OLED 14" Touchscreen i5 12 Core 16GB/512GB
    CPU
    Intel Core 12th Gen i5-1240P Processor (1.7 - 4.4GHz)
    Memory
    16GB LPDDR5 RAM
    Graphics card(s)
    Intel Iris Xe Graphics Processor
    Sound Card
    Optimized with Dolby Atmos®
    Screen Resolution
    QHD 2880 x 1800 OLED
    Hard Drives
    M.2 512GB
    Other Info
    …still on a horse.
99% hey?… Statistics.
Because new pc comes preinstalled with Windows 11, so 99% users who are purchasing new machines are using Windows 11
Windows users are increasing in numbers day by day, but all are preinstalled windows 11 users.(As far as purchase of new macine is concerned)
Windows 10 users are not giving up windows 10.
So assembled pc users demand Windows 10 only.
🙏
 

My Computer

System One

  • OS
    Window 11 v24H2 Build 26100.2033
    Computer type
    PC/Desktop
    Manufacturer/Model
    ASSEMMBLED
    CPU
    Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz 3.10 GHz
    Motherboard
    ZEBRONICS
    Memory
    4.00 GB (3.89 GB usable)
    Graphics Card(s)
    Onboard
    Sound Card
    Onboard
    Monitor(s) Displays
    LG
    Screen Resolution
    1366x768
    Hard Drives
    Toshiba HDD 1 TB
    Keyboard
    Mechanical
    Mouse
    Mechanical
    Internet Speed
    700 kb/s
    Browser
    Microsoft EDGE, CHROME
    Antivirus
    Microsoft Defender
Again the main question remains unanswered.
Why bootable usb fails to install Windows 11 on pc which meets 100% correct hardware requirements for Windows 11 v24H2?
Ramesh, sorry, I misunderstood. Clarify for me what kind of errors or problems they are seeing.
 

My Computers

System One System Two

  • OS
    Win11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Kamrui Mini PC, Model CK10
    CPU
    Intel i5-12450H
    Memory
    32GB
    Graphics Card(s)
    No GPU - Built-in Intel Graphics
    Sound Card
    Integrated
    Monitor(s) Displays
    HP Envy 32
    Screen Resolution
    2560 x 1440
    Hard Drives
    1 x 2TB NVMe SSD
    1 x 4TB NVMe SSD
    1 x 4TB 2.5" SSD
    PSU
    120W "Brick"
    Keyboard
    Corsair K70 Mechanical Keyboard
    Mouse
    Logitech MX Master 3
    Internet Speed
    1Gb Up / 1 Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
  • Operating System
    Win11 Pro 23H2
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo ThinkBook 13x Gen 2
    CPU
    Intel i7-1255U
    Memory
    16 GB
    Graphics card(s)
    Intel Iris Xe Graphics
    Sound Card
    Realtek® ALC3306-CG codec
    Monitor(s) Displays
    13.3-inch IPS Display
    Screen Resolution
    WQXGA (2560 x 1600)
    Hard Drives
    2 TB 4 x 4 NVMe SSD
    PSU
    USB-C / Thunderbolt 4 Power / Charging
    Mouse
    Buttonless Glass Precision Touchpad
    Keyboard
    Backlit, spill resistant keyboard
    Internet Speed
    1Gb Up / 1Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
    Other Info
    WiFi 6e / Bluetooth 5.1 / Facial Recognition / Fingerprint Sensor / ToF (Time of Flight) Human Presence Sensor
Ramesh, sorry, I misunderstood. Clarify for me what kind of errors or problems they are seeing.
Mostly related with secure boot.
Isn't bootable usb of Windows 11 prepared by making two partitions FAT32 and NTFS work for both conditions i. e. secure boot enabled or disabled?
Such bootable usb should not fail on 100% correct hardware for Windows 11 installation.
 

My Computer

System One

  • OS
    Window 11 v24H2 Build 26100.2033
    Computer type
    PC/Desktop
    Manufacturer/Model
    ASSEMMBLED
    CPU
    Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz 3.10 GHz
    Motherboard
    ZEBRONICS
    Memory
    4.00 GB (3.89 GB usable)
    Graphics Card(s)
    Onboard
    Sound Card
    Onboard
    Monitor(s) Displays
    LG
    Screen Resolution
    1366x768
    Hard Drives
    Toshiba HDD 1 TB
    Keyboard
    Mechanical
    Mouse
    Mechanical
    Internet Speed
    700 kb/s
    Browser
    Microsoft EDGE, CHROME
    Antivirus
    Microsoft Defender
Mostly related with secure boot.
Isn't bootable usb of Windows 11 prepared by making two partitions FAT32 and NTFS work for both conditions i. e. secure boot enabled or disabled?
Such bootable usb should not fail on 100% correct hardware for Windows 11 installation.
Ahhh, yes. So, there are some odd issues related to the whole Secure Boot mitigations (remember those?). The manner in which I create my bootable media tries to patch the media to be compatible with systems that have those mitigations applied.

However, in the real world, I really wouldn't expect to see that happen much because not many people apply those mitigations. Out of curiosity, are these rather new machines where maybe those mitigations are already applied from the factory?

So, there are a couple of ways to address this. Option 1 is by far the easiest and I hesitated even mentioning option 2, but I think it only fair to present both options:

1) Just disable Secure Boot temporarily for the installation. Remember, Win 11 does NOT require Secure Boot to be enabled. It only requires that the system be capable of running Secure Boot. After installation, you can always enable Secure Boot.

2) Take a look at my batch file below that creates bootable media. It will patch your Windows installation media to make sure that it can run on systems with those mitigations applied. Just search for the text "Checking to see if this system has BlackLotus UEFI Bootkit Secure Boot mitigations". Note that in order to apply the mitigations to the installation media, the system that the batch file is run on must have those mitigations installed.

Batch:
@echo off
setlocal enabledelayedexpansion
setlocal enableextensions
cd /d %~dp0

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This batch file will allow you to create a Windows installation disk. This can be a flash drive, HDD or   ::
:: an SSD. It is designed to create a drive that will boot on either a BIOS or UEFI based system and it is   ::
:: perfectly fine for any files in the installation media to be larger than 4 GB.                            ::
::                                                                                                           ::
:: Note that Windows 11 is only available in 64-bit editions, while Windows 10 is available in both 32-bit   ::
:: and 64-bit editions. Since this batch file is perfectly capable of creating dual architecture media it is ::
:: perfectly suitable for the creation of both Windows 10 and Windows 11 boot media, regardless of whether   ::
:: the image is 32-bit or 64-bit.                                                                            ::
::                                                                                                           ::
:: Originally created December 2020 by HSehestedt and Ztruker                                                ::
:: Last updated September 9, 2024                                                                            ::
::                                                                                                           ::
:: Version 2.01.13                                                                                           ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: A quick note about storage size: Microsoft considers 1 KB to be 1024 bytes rather than 1000 bytes. However,  ::
:: storage vendors typically consider 1 KB to be 1000 bytes. In order to be completely technically correct, the ::
:: latest convention holds that 1 KB = 1000 bytes and 1 KiB = 1024 bytes, but Microsoft uses the term KB for    ::
:: for what should technically be a KiB. In the text below we are not getting caught up in these differences.   ::
:: If you see that Windows reports slightly different sizes than expected, this is the reason why. This will    ::
:: not make any difference to what we are doing here.                                                           ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Explanation of User Customizable Settings ::                                                                   ::
:::::::::::::::::::::::::::::::::::::::::::::::                                                                   ::
:: Set the variables below to customize the behavior of the batch file.                                           ::
::                                                                                                                ::
:: NOTE: Values supplied can be either uppercase, lowercase, or mixed case. However, please note that for the     ::
::    FAT32 partition, the volume name will be automatically converted to uppercase since FAT32 volume names can  ::
::    only be uppercase.                                                                                          ::
::                                                                                                                ::
:: HideDetails - Set to "Y" to hide the details of every file being copied. Set to "N" or anything other than     ::
::    "Y" to show the detailed copy status. May be helpful for troubleshooting.                                   ::
::                                                                                                                ::
:: Partition1Size - This specifies the size in MB to create the first FAT32 partition. Suggestion: 1000 MB        ::
::    (1GB) should be a good value for most situations. Use a number only (no MB after the number). If you use a  ::
::    customized image with many Windows editions, it's possible that you may need to increase the size of this   ::
::    partition.                                                                                                  ::
::                                                                                                                ::
:: Part2SizeLimit - Set to either "N" or a numerical value. If you set this to "N", the size of the 2nd           ::
::    partition will be unlimited and will be created with all the remaining space not used by partition 1. If    ::
::    you would like to limit the size of the partition, specify a size in MB to create this partition.           ::
::    Note: 1 GB would be 1000 and 1 TB would be 1000000 (DON'T USE A COMMA IN VALUE!). Limiting the size is      ::
::    useful if you want to add other partitions to the drive. For example, I have a flash drive that I can       ::
::    install Windows from, but it also has another partition that is BitLocker protected with all my software    ::
::    applications, personal documents, etc.                                                                      ::
::                                                                                                                ::
:: Part2FS - This sets the filesystem type to use on the 2nd partition. Either exFAT or NTFS can be specified.    ::
::    Set this value to either "NTFS" or "exFAT". My personal preference is to always use NTFS.                   ::
::                                                                                                                ::
:: Partition1Name - This is the volume label to give the first partition. Since this is a FAT32 partition, the    ::
::    volume label is limited to 11 characters.                                                                   ::
::                                                                                                                ::
:: Partition2Name - This is the volume label to give the second partition. If you choose to use exFAT you are     ::
::    limited to 11 characters. With NTFS you have up to 32 characters. Note that by default we use the name      ::
::    PAR-2-%Part2FS%. The %Part2FS% is the variable that contains either NTFS or exFAT (whichever you specified  ::
::    for that variable). Of course, you do not have to use this and can modify it if you wish.                   ::
::                                                                                                                ::
:: PartType - Set to either MBR or GPT. Normally, leave this set to MBR. An MBR partition type will allow for the ::
::    greatest compatibility with both BIOS and UEFI based systems. However, it is limited to disks with up to    ::
::    2 TB in size. If you plan to use a disk larger than 2 TB you must specify a GPT partition type. Please be   ::
::    aware that doing this will limit compatibility so that it will not work on BIOS based systems.              ::
::                                                                                                                ::
:: AutoDismount - Set this to Y if you want the source ISO image to be automatically dismounted by this batch     ::
::    file when it is done running. If you do NOT want the image dismounted, set this to N. NOTE: Technically,    ::
::    the image will be dismounted when set to anything other than N.                                             ::
::    IMPORTANT: Set this to Y only if the source is an ISO image. If you are pointing to a folder on a drive,    ::
::    then this should be set to N.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


:: User defined variables

set HideDetails=Y
set Partition1Size=1000
set Part2SizeLimit=N
set Part2FS=NTFS
set Partition1Name=PAR-1-FAT32
set Partition2Name=PAR-2-%Part2FS%
set PartType=MBR
set AutoDismount=Y

:: End of user defined variables

:start

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Check to see if this batch file is being run as Administrator. If it is not, then rerun the batch file ::
:: automatically as admin and terminate the intial instance of the batch file.                            ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

(Fsutil Dirty Query %SystemDrive%>Nul)||(PowerShell start """%~f0""" -verb RunAs & Exit /B)

::::::::::::::::::::::::::::::::::::::::::::::::
:: End Routine to check if being run as Admin ::
::::::::::::::::::::::::::::::::::::::::::::::::

:: We reach this point once the batch file is run as admin

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Convert all variable values to uppercase to make handling easier. ::
:: We do this by calling a user function called TOUPPERCASE.         ::
::                                                                   ::
:: NOTE: We do NOT convert the volume name for the 2nd partition to  ::
:: uppercase since lowercase volume names are valid for both exFAT   ::
:: and NTFS partitions.                                              ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

call ::TOUPPERCASE HideDetails
call ::TOUPPERCASE Partition1Size
call ::TOUPPERCASE Part2SizeLimit
call ::TOUPPERCASE Part2FS
call ::TOUPPERCASE Partition1Name
call ::TOUPPERCASE PartType
call ::TOUPPERCASE AutoDismount

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: If the user wants to hide the details of files being copied, we append a "/nfl /ndl" to the end     ::
:: of robocopy commands. By setting a flag to either nothing or to "/nfl /ndl" we can use the same     ::
:: commands and the variable "flag" at the end of each command will determine how the command behaves. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if %HideDetails%==Y (
set flag=/nfl /ndl
) ELSE (
set flag=
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Change the console mode to 120 columns wide by 25 lines high ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

mode con: cols=120 lines=25

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Ask user for location of mounted ISO image or the directory containing the Windows files ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

cls
echo Introduction
echo ============
echo.
echo This batch file will create a bootable flash drive from a mounted Windows ISO image or an image extracted to disk.
echo If you are using an ISO image, mount it before you continue by double-clicking the ISO image and note the drive
echo letter to which it is mounted.
echo.
echo You will be asked if you want to wipe the destination disk or perform a refresh operation. If this is the first
echo time preparing the disk, use the WIPE option. Be aware that this will destroy ALL data currently on the disk^^!
echo.
echo If you choose the REFRESH option, you will be asked for the drive letter of the two partitions previously
echo created on the disk. We will then replace the files on these partitions with those from the source that you
echo specify. This is especially helpful if you create additional partitions on the disk because it will update
echo the first two partitions while leaving any additional partitions intact.
echo.
pause
cls
echo Do you want to perform a WIPE operation or a REFRESH operation?
echo.
choice /C WR /N /M "Press W or R to respond:"
if errorlevel 2 set WipeRefresh=REFRESH & goto GetSourcePath
if errorlevel 1 set WipeRefresh=WIPE & goto GetSourcePath

:GetSourcePath

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Get the path to the Windows source files.                           ::
:: Tip: The path can end with or without a backslash (\). For example, ::
:: either D:, D:\, D:\ISO_Files, D:\ISO_Files\ are all valid paths.    ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

cls
echo Please enter the path to the SOURCE where your Windows files are located. This location can be a folder on a
echo HDD, SSD, etc. or it can be a mounted Windows ISO image. The path can end with or without a backslash (\).
echo The following are all examples of valid paths:
echo.
echo D:, D:\, D:\ISO_Files, D:\ISO_Files\ are all valid paths.
echo.
echo Enter the path to the SOURCE where your Windows files are located below.
echo.
:GetSourcePath
set /p SourcePath="Enter source path: "

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Add a trailing backslash (\) if one does not exist. This ensures  ::
:: consistency so that the source path always ends with a backslash. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

IF NOT "%SourcePath:~-1%"=="\" (
set SourcePath=%SourcePath%\
)

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Any valid Windows boot media will have a file called "boot\bootfix.bin" on the drive. This is true for both ::
:: single architecture images (x64 or x86) or for images with dual architectures. We will do a simple check to ::
:: see if such a file exists as a basic test for a valid source image location.                                ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if NOT EXIST %SourcePath%boot\bootfix.bin (
cls
echo The location that you specified does not contain a valid Windows image. Please try another location.
echo If you are specifying a location on disk, please be sure to specify the location to the root of the
echo Windows image. If you are using an ISO image, you should double-click the ISO image to mount it and
echo note the drive letter to which it was mounted.
echo.
goto GetSourcePath
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The directory structure for a dual architecture image (one that has BOTH x64 and x86 images) will include    ::
:: \x64 and \x86 folders. In order for us to properly handle this, we need to determine if the source specified ::
:: is a single of dual architecture image. To do so, we will simply check for the existance on a \x64 folder.   ::
:: The variable Architecture will be set to either SINGLE or DUAL.                                              ::
::                                                                                                              ::
:: TIP: Windows 11 is only available in 64-bit editions. As a result, you will never have a dual architecture   ::
:: edition of Windows 11.                                                                                       ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if exist %SourcePath%\x64 (
set Architecture=DUAL
) ELSE (
set Architecture=SINGLE
)

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: If a refresh operation was selected, then we need to ask the user for the drive letter associated ::
:: with the partitions. Otherwise, we need to identify what disk will be wiped.                      ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

If %WipeRefresh%==WIPE goto GetDiskNum

:GetPar1Letter

cls
echo Please enter the drive letter of the FIRST partition (the FAT32 partition) on the disk that we will refresh. Please
echo enter a drive letter only with no colon (:).
echo.
set /P Partition1="Drive letter of FIRST partition: "

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: As a safety check, verify that the first partition has a file \boot\bootfix.bin ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if exist %Partition1%:\boot\bootfix.bin goto GetPar2Letter
cls
echo ERROR! Either the drive letter you specified does not exist or it does not seem to contain a previously
echo created partition with suitable Windows installation files.
echo.
echo Please verify that you have specified the correct drive letter.
echo.
pause
goto GetPar1Letter

:GetPar2Letter

cls
echo Please enter the drive letter of the SECOND partition (the exFAT or NTFS partition) on the disk that we will
echo refresh. Please enter a drive letter only with no colon (:).
echo.
set /P Partition2="Drive letter of SECOND partition: "

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: As a safety check, verify that the second partition has either a \sources or a \x64 folder. ::
:: A \sources folder will exist for either an x64 or x86 image, while \x64 and \x86 folders    ::
:: will exist only on a dual architecture image. We only need to check for one of these to     ::
:: know if the image is dual architecture. In this batch file, we just check for the existance ::
:: of an \x64 folder.                                                                          ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if exist %Partition2%:\Sources goto Par2Valid
if exist %Partition2%:\x64 goto Par2Valid

cls
echo ERROR! Either the drive letter you specified does not exist or it does not seem to contain a previously
echo created partition with suitable Windows installation files.
echo.
echo Please verify that you have specified the correct drive letter.
echo.
pause
goto GetPar2Letter

:Par2Valid

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Since we are performing a refresh operation, there is no need for us to get a disk number. We will ::
:: skip that and proceed to the summary screen.                                                       ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

goto Summary

:GetDiskNum

:::::::::::::::::::::::::::::::::::::::::::::::::
:: Display a list of disks seen by the system. ::
:::::::::::::::::::::::::::::::::::::::::::::::::

cls
(echo list disk
echo exit
) | diskpart

echo.
echo Above is a list of disks connected to your system. Scroll up if the list is too long.
echo CAUTION: *MAKE SURE* that you specify the correct disk because it will be erased. Press CTRL + C to abort.
echo.
set /p DiskID="Enter the disk number for the DESTINATION disk (Enter only the number and press ENTER): "

if [%DiskID%] EQU [] Goto GetDiskNum

:Summary

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Display a summary of options that will be used and get confirmation ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

cls
echo Summary of options you have selected:
echo.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: These summary items apply to both WIPE and REFRESH operations ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

call ::TOUPPERCASE SourcePath
echo Path for the source files: %SourcePath%

if %HideDetails%==Y (
echo File copy status details WILL NOT be displayed
) ELSE (
echo File copy status details WILL be displayed
)

if %AutoDismount%==Y (
echo The ISO image will be automatically dismounted when we are done with it
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The summary items below apply only to WIPE operations, so if a ::
:: REFRESH is being performed, skip this section                  ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if %WipeRefresh%==REFRESH goto RefreshSummary

echo Drive number to make bootable: %DiskID%
echo Partition type: %PartType%
echo Partition 1 size: %Partition1Size% MB
echo Partition 2 filesystem type: %Part2FS%

if NOT %Part2SizeLimit%==N (
echo Partition 2 size: %Part2SizeLimit% MB
) ELSE (
echo Partition 2 size: Use all remaining space
)

echo Partition 1 volume label: %Partition1Name%
echo Partition 2 volume label: %Partition2Name%

goto GetConfirmation

:RefreshSummary

::::::::::::::::::::::::::::::::::::::::::::::::::::
:: These items apply only to a REFRESH operation. ::
::::::::::::::::::::::::::::::::::::::::::::::::::::

call ::TOUPPERCASE Partition1
call ::TOUPPERCASE Partition2
echo Drive letter of FIRST partition to refresh: %Partition1%:
echo Drive letter of SECOND partition to refresh: %Partition2%:

:GetConfirmation

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Time to get final confirmation from user. If the user does not confirm ::
:: that everything is correct, show some possible resolutions.            ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

echo.
choice /C YN /N /M "Is this correct? (Press Y or N to respond):"
if errorlevel 2 (
cls
echo.
echo        Symptom                                            Corrective Action
echo        =======                                            =================
echo Source path is wrong:                 Run the program again and respond with the correct path
echo Wrong drive number for a WIPE:        Run the program again and respond with the correct drive number
echo Wrong drive letters for a REFRESH:    Run the program again and respond with the correct drive letters
echo File copy status display incorrect:   Change the setting of "HideDetails" at start of program
echo Wrong partition sizes:                Change the setting of "Partition1Size" or "Part2SizeLimit" at start of program
echo Wrong volume labels for a WIPE:       Change the setting of "Partition1Name" or "Partition2Name" at start of program
echo Wrong partition type:                 Change the setting of "PartType" at start of program
echo.
pause
exit
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: We are creating 2 partions. A FAT32 partition and an exFAT or NTFS partition. We only need the \sources  ::
:: folder on the exFAT or NTFS partition. On the FAT32 partition, we want everything else. We also want the ::
:: single file called BOOT.WIM in the \sources folder on the FAT32 partition.                               ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

cls
if %WipeRefresh%==WIPE echo We are performing the initial partitioning the destination drive to free up any used drive letters.
if %WipeRefresh%==REFRESH echo We are refreshing drives %Partition1%: and %Partition2%:. Other partitions will be left alone.
echo Please be patient^^! This can take a while if your drive is slow.
echo.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: If we are performing a REFRESH, then there are a lot of steps that we can skip. ::
:: As a result, we will skip to the CopyOperations section.                        ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if %WipeRefresh%==REFRESH goto CopyOperations

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: We will first wipe the selected disk. This will free up any drive letters currently used by that disk. ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

(echo select disk %DiskID%
echo clean
echo convert %PartType%
echo rescan
echo exit
) | diskpart > nul

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Ask user for drive letters to assign to the partitions on the destination drive ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:GetPar1DriveLetter

cls
echo Please enter the drive letter to assign to the FIRST partition (the FAT32 partition). Please enter
echo a drive letter only with no colon (:).
echo.
set /p Partition1="Enter the drive letter to assign to Partition #1: "

if exist %Partition1%: (
echo.
echo That drive letter is already in use. Please choose another.
echo.
pause
goto GetPar1DriveLetter
)

:GetPar2DriveLetter

cls
echo Please enter the drive letter to assign to the SECOND partition (the NTFS partition). Please enter
echo a drive letter only with no colon (:).
echo.
set /p Partition2="Enter the drive letter to assign to Partition #2: "

if exist %Partition2%: (
echo.
echo That drive letter is already in use. Please choose another.
echo.
pause
goto GetPar2DriveLetter
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Capitalize the drive letters. This serves no real purpose other than ::
:: making the output of the messages below look a bit better when we    ::
:: confirm the drive letter assignments.                                ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

call ::TOUPPERCASE Partition1
call ::TOUPPERCASE Partition2

:::::::::::::::::::::::::::::::::
:: Prepare the first partition ::
:::::::::::::::::::::::::::::::::

cls
echo The first partition will be assigned drive letter %Partition1%: and will be formatted with FAT32.

(echo select disk %DiskID%
echo create partition primary size=%Partition1Size%
echo format fs=fat32 quick
echo assign letter=%Partition1%
echo active
echo rescan
echo exit
) | diskpart > nul

::::::::::::::::::::::::::::::::::
:: Prepare the second partition ::
::::::::::::::::::::::::::::::::::

echo The second partition will be assigned drive letter %Partition2%: and will be formatted with %Part2FS%.
echo.

if %Part2SizeLimit%==N goto NoSizeLimit

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: User has elected to create the second partition with a specific size ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

(echo select disk %DiskID%
echo create partition primary size=%Part2SizeLimit%
echo format fs=%Part2FS% quick
echo assign letter=%Partition2%
echo rescan
echo exit
) | diskpart > nul

goto PartitionsCreated

:NoSizeLimit

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: User has elected create the second partition with all remaining space ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

(echo select disk %DiskID%
echo create partition primary
echo format fs=%Part2FS% quick
echo assign letter=%Partition2%
echo rescan
echo exit
) | diskpart > NUL

:PartitionsCreated

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Set volume labels on the two partitions that we just created. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

label %Partition1%:%Partition1Name%
label %Partition2%:%Partition2Name%

:CopyOperations

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This section is for the copy operations from SOURCE to DESTINATION ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Technical Notes:                                                                                                 ::
::                                                                                                                  ::
:: Some flash drives present themselves as a fixed disk and as a result they my have a recyle bin folder on them.   ::
:: We are excluding the system folders which includes the recycle bin from the following operation. The /njh and    ::
:: /njs switches prevent robocopy from displaying the header and summary information. If you want to stop robocopy  ::
:: from displaying file copy progress just add a /nfl /ndl (No File Listing and No Directory Listing) to each       ::
:: robocopy command. Note that if the user elected to hide details of the copy operation, then the variable "flag"  ::
:: will be set to "/nfl /ndl" which will hide the directory and file listings.                                      ::
::                                                                                                                  ::
:: Sometimes a path enclosed in quotes does not work in robocopy unless you add a trailing space. Specifically,     ::
:: this will happen if a path ends with a backslash (\). Since the source path always ends with a backslash in this ::
:: project, we add that space after the source path even when modified just to be sure that the robocopy command    ::
:: will work.                                                                                                       ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if %HideDetails%==Y (
echo Please be aware that the copying of files may take quite a while if your media is slow. Since you
echo have the variable called HideDetails set to Y, you will see no status below while files are being
echo copied. Please be patient and allow the process to finish.
echo.
)

if %Architecture%==DUAL goto DualArchitecture

::::::::::::::::::::::::::::::::::::::::::
:: Copying files to the FAT32 partition ::
::::::::::::::::::::::::::::::::::::::::::

robocopy "%SourcePath% " %Partition1%:\ /mir /xd sources "system volume information" $recycle.bin /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler1
robocopy "%SourcePath%sources " %Partition1%:\sources boot.wim /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler1

::::::::::::::::::::::::::::::::::::::::::::::::::
:: Copying files to the exFAT or NTFS partition ::
::::::::::::::::::::::::::::::::::::::::::::::::::

robocopy "%SourcePath%sources " %Partition2%:\sources /mir /njh /njs /xf boot.wim %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%SourcePath%boot " %Partition2%:\boot /mir /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%SourcePath%efi " %Partition2%:\efi /mir /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%SourcePath%support " %Partition2%:\support /mir /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%Partition1%:\ " "%Partition2%:\ " /mov autounattend*.xml /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
pause

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Creating an ei.cfg file. This will allow the user to select the edition of Windows to ::
:: be installed even if the OEM BIOS has a signature for a specific edition of Windows.  ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if NOT exist %Partition2%:\sources\ei.cfg (
echo [CHANNEL] > %Partition2%:\sources\ei.cfg
echo Retail >> %Partition2%:\sources\ei.cfg
)

goto DoneCopying

:DualArchitecture

::::::::::::::::::::::::::::::::::::::::::
:: Copying files to the FAT32 partition ::
::::::::::::::::::::::::::::::::::::::::::

robocopy "%SourcePath% " %Partition1%:\ /mir /xd sources x64 x86 "system volume information" $recycle.bin /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler1
robocopy "%SourcePath%x64\sources " %Partition1%:\x64\sources boot.wim /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler1
robocopy "%SourcePath%x86\sources " %Partition1%:\x86\sources boot.wim /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler1

::::::::::::::::::::::::::::::::::::::::::::::::::
:: Copying files to the exFAT or NTFS partition ::
::::::::::::::::::::::::::::::::::::::::::::::::::

robocopy "%SourcePath%x64\sources " %Partition2%:\x64\sources /mir /njh /njs /xf boot.wim /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%SourcePath%x86\sources " %Partition2%:\x86\sources /mir /njh /njs /xf boot.wim /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%SourcePath%x64\boot " %Partition2%:\x64\boot /mir /njh /njs /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%SourcePath%x86\boot " %Partition2%:\x86\boot /mir /njh /njs /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%SourcePath%x64\efi " %Partition2%:\x64\efi /mir /njh /njs /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%SourcePath%x86\efi " %Partition2%:\x86\efi /mir /njh /njs /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%SourcePath%x64\support " %Partition2%:\x64\support /mir /njh /njs /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%SourcePath%x86\support " %Partition2%:\x86\support /mir /njh /njs /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2
robocopy "%Partition1%:\ " "%Partition2%:\ " /mov autounattend*.xml /njh /njs %flag%
if %ERRORLEVEL% gtr 3 goto ErrorHandler2

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Creating an ei.cfg file. This will allow the user to select the edition of Windows to ::
:: be installed even if the OEM BIOS has a signature for a specific edition of Windows.  ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if NOT exist %Partition2%:\x64\sources\ei.cfg (
echo [CHANNEL] > %Partition2%:\x64\sources\ei.cfg
echo Retail >> %Partition2%:\x64\sources\ei.cfg
)

if NOT exist %Partition2%:\x86\sources\ei.cfg (
echo [CHANNEL] > %Partition2%:\x86\sources\ei.cfg
echo Retail >> %Partition2%:\x86\sources\ei.cfg
)

:DoneCopying

:::::::::::::::::::::::::::::
:: Dismount the disk image ::
:::::::::::::::::::::::::::::

IF %AutoDismount%==N goto DismountDone

:::::::::::::::::::::::::::::::::::::::
:: Strip the backslash from the path ::
:::::::::::::::::::::::::::::::::::::::

IF "!SourcePath:~-1!"=="\" SET SourcePath=!SourcePath:~,-1!

::::::::::::::::::::::::
:: Dismount the image ::
::::::::::::::::::::::::

powershell.exe -command "Dismount-DiskImage -DevicePath \\.\%SourcePath%" > NUL

:DismountDone

cls
echo ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo :: Checking to see if this system has BlackLotus UEFI Bootkit Secure Boot mitigations ::
echo :: installed. If it does, we will use this to make your boot disk compatible with     ::
echo :: systems that have this update applied. Please note that we can only make this disk ::
echo :: compatible from systems that have this mitigation applied.                         ::
echo ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo.

:: Check to make sure that the first of two mitigations are applied to this system.
:: The first mitigation adds the "Windows UEFI CA 2023" certificate to the UEFI "Secure Boot Signature Database" (DB).
:: By adding this certificate to the DB, the device firmware will trust boot applications signed by this certificate.

for /f %%a in ('powershell "[System.Text.Encoding]::ASCII.GetString((Get-SecureBootUEFI db).bytes) -match 'Windows UEFI CA 2023'"') do set "PowerShellOutput=%%a"

if "%PowerShellOutput%"=="True" (
    goto CheckCondition2
) else (
    goto NotInstalled
)

:CheckCondition2

:: Check to make sure that the second of two mitigations are applied to this system.
:: The UEFI Forbidden List (DBX) is used to block untrusted UEFI modules from loading. The second mitigation updates the
:: DBX by adding the "Windows Production CA 2011" certificate to the DBX. This will cause all boot managers signed by
:: this certificate to no longer be trusted.

for /f %%a in ('powershell "[System.Text.Encoding]::ASCII.GetString((Get-SecureBootUEFI dbx).bytes) -match 'Microsoft Windows Production PCA 2011'"') do set "PowerShellOutput=%%a"

if "%PowerShellOutput%"=="True" (
    goto Condition2True
) else (
    goto NotInstalled
)

:Condition2True

:: We have verified that the mitigations for the BlackLotus UEFI Bootkit are installed on this system. We will now update
:: the boot media to ensure that it can be successfully booted on systems with this mitigation applied.

:: Make sure that the files on the destination disk are not read only

attrib %Partition1%:\*.* -r /s /d > NUL 2>&1

:: Update the boot media to ensure compatibility with the mitigations.

COPY /Y %Partition1%:\EFI\MICROSOFT\BOOT\BCD %Partition1%:\EFI\MICROSOFT\BOOT\BCD.BAK > NUL
bcdboot c:\windows /f UEFI /s %Partition1%: /bootex > NUL 2>&1
COPY /Y %Partition1%:\EFI\MICROSOFT\BOOT\BCD.BAK %Partition1%:\EFI\MICROSOFT\BOOT\BCD > NUL

echo This system has the mitigations installed so we were able to patch your boot disk.
echo.
pause
goto DoneWithMitigation

:NotInstalled

echo This system does NOT have the mitigations installed so we are NOT able to patch your boot disk.
echo It is possible that disk may not boot on systems with those mitigations applied.
echo.
pause
goto DoneWithMitigation

:DoneWithMitigation


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Inform the user that we are done. Also, as a precaution, check to see if an ::
:: unattended setup answer file is present and warn the user if it is.         ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

cls
echo All operations have been completed.
echo.

if exist %Partition2%:\autounattend.xml (
echo ^^!CAUTION^^! An unattended setup file ^(autounattend.xml^) is present on the 2nd partition.
echo As a result, if you boot from this disk, an unattended installation will begin. This has
echo the potential to wipe out the contents of disks attached to your system without warning.
echo.
echo It might be a wise idea to carefully label the bootable media to reflect this situation.
echo As an alternative, consider temporarily renaming the autounattend.xml to something else.
echo.
)
pause

:END

exit


:::::::::::::::
:: FUNCTIONS ::
:::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The following is a function that can be called to convert ::
:: the contents of a variable to uppercase characters.       ::
::                                                           ::
:: To use this function, call this function and pass it the  ::
:: name of the variable to convert. In the example below we  ::
:: are passing "str" as the variable name.                   ::
::                                                           ::
:: Example: call ::TOUPPERCASE str                           ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:TOUPPERCASE
if not defined %~1 exit /b
for %%a in ("a=A" "b=B" "c=C" "d=D" "e=E" "f=F" "g=G" "h=H" "i=I" "j=J" "k=K" "l=L" "m=M" "n=N" "o=O" "p=P" "q=Q" "r=R" "s=S" "t=T" "u=U" "v=V" "w=W" "x=X" "y=Y" "z=Z" "ä=Ä" "ö=Ö" "ü=Ü") do (
call set %~1=%%%~1:%%~a%%
)
goto :eof


:::::::::::::::::::::::::::::
:: Error Handling Routines ::
:::::::::::::::::::::::::::::

:ErrorHandler1

cls
echo There was an error copying files to partition #1. Please verify that partition #1 has sufficient space available.
echo Please correct the situation and run the script again. If you are changing the partition sizes, then you will
echo need to use the WIPE operation to create new partitions with the newly specified sizes.
echo.
pause
goto END

:ErrorHandler2

cls
echo There was an error copying files to partition #2. Please verify that partition #2 has sufficient space available.
echo Please correct the situation and run the script again. If you are changing the partition sizes, then you will
echo need to use the WIPE operation to create new partitions with the newly specified sizes.
echo.
pause
goto END
 

My Computers

System One System Two

  • OS
    Win11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Kamrui Mini PC, Model CK10
    CPU
    Intel i5-12450H
    Memory
    32GB
    Graphics Card(s)
    No GPU - Built-in Intel Graphics
    Sound Card
    Integrated
    Monitor(s) Displays
    HP Envy 32
    Screen Resolution
    2560 x 1440
    Hard Drives
    1 x 2TB NVMe SSD
    1 x 4TB NVMe SSD
    1 x 4TB 2.5" SSD
    PSU
    120W "Brick"
    Keyboard
    Corsair K70 Mechanical Keyboard
    Mouse
    Logitech MX Master 3
    Internet Speed
    1Gb Up / 1 Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
  • Operating System
    Win11 Pro 23H2
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo ThinkBook 13x Gen 2
    CPU
    Intel i7-1255U
    Memory
    16 GB
    Graphics card(s)
    Intel Iris Xe Graphics
    Sound Card
    Realtek® ALC3306-CG codec
    Monitor(s) Displays
    13.3-inch IPS Display
    Screen Resolution
    WQXGA (2560 x 1600)
    Hard Drives
    2 TB 4 x 4 NVMe SSD
    PSU
    USB-C / Thunderbolt 4 Power / Charging
    Mouse
    Buttonless Glass Precision Touchpad
    Keyboard
    Backlit, spill resistant keyboard
    Internet Speed
    1Gb Up / 1Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
    Other Info
    WiFi 6e / Bluetooth 5.1 / Facial Recognition / Fingerprint Sensor / ToF (Time of Flight) Human Presence Sensor
Thanks @hsehestedt,
I have to study this script to make bootable usb.
 

My Computer

System One

  • OS
    Window 11 v24H2 Build 26100.2033
    Computer type
    PC/Desktop
    Manufacturer/Model
    ASSEMMBLED
    CPU
    Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz 3.10 GHz
    Motherboard
    ZEBRONICS
    Memory
    4.00 GB (3.89 GB usable)
    Graphics Card(s)
    Onboard
    Sound Card
    Onboard
    Monitor(s) Displays
    LG
    Screen Resolution
    1366x768
    Hard Drives
    Toshiba HDD 1 TB
    Keyboard
    Mechanical
    Mouse
    Mechanical
    Internet Speed
    700 kb/s
    Browser
    Microsoft EDGE, CHROME
    Antivirus
    Microsoft Defender
Such bootable usb should not fail on 100% correct hardware for Windows 11 installation.

100% ?. Your CPU is not on the Windows 11 supported list. Yes, is supports SSE4.2, but it's still not on the list.

Please download and run WhyNotWin11.


Here's what 100% supported hardware should look like.
1725949183940.png
 

My Computers

System One System Two

  • OS
    Win 11 Pro 24H2 26100.3037
    Computer type
    PC/Desktop
    Manufacturer/Model
    Self Built
    CPU
    Intel® Core™ i7-14700F
    Motherboard
    ASUS TUF GAMING Z690-PLUS WIFI
    Memory
    G.SKILL Ripjaws S5 Series 64GB (2 x 32GB) DDR5
    Graphics Card(s)
    MSI GeForce RTX 3060 Ventus 2X 12GB OC
    Sound Card
    Sound Blaster AE-5 Plus
    Monitor(s) Displays
    ASUS TUF Gaming 27" 2K HDR Gaming
    Screen Resolution
    2560 x 1440
    Hard Drives
    Samsung 990 Pro 1TB NVMe (Win 11 24H2)
    SK hynix P41 500GB NVMe (Win 11 23H2)
    SK hynix P41 2TB NVMe (x3)
    Crucial P3 Plus 4TB
    PSU
    Corsair RM850x Shift
    Case
    Antec Dark Phantom DP502 FLUX
    Cooling
    Noctua NH-U12A chromax.black + 7 Phantek T-30's
    Keyboard
    Logitech MK 320
    Mouse
    Razer Basilisk V3
    Internet Speed
    350Mbs
    Browser
    Firefox
    Antivirus
    Winows Security
    Other Info
    Windows 11 23H2 22631.4830
    On System One (Dual Boot)
  • Operating System
    Win 11 Pro 24H2 26100.3037
    Computer type
    PC/Desktop
    Manufacturer/Model
    Self Built
    CPU
    Intel Core i7-11700F
    Motherboard
    Asus TUF Gaming Z590 Plus WiFi
    Memory
    64 GB DDR4
    Graphics card(s)
    EVGA GeForce RTX 3050 XC Black Gaming
    Sound Card
    SoundBlaster X-Fi Titanium
    Monitor(s) Displays
    Samsung F27T350
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 980 Pro 1TB
    Samsung 970 EVO Plus 2TB
    Samsung 870 EVO 500GB SSD
    PSU
    Corsair HX750
    Case
    Cougar MX330-G Window
    Cooling
    Hyper 212 EVO
    Internet Speed
    350Mbps
    Browser
    Firefox
    Antivirus
    Windows Security
So,

Are we seeing pages and pages of posts in this thread, because certain people don't know how to use Rufus, to create Win11 boot USB?

Or, is it because, OP wants to perform in place upgrade from W1123H2 to W1124H2, on "incompatible machine" !?
 

My Computers

System One System Two

  • OS
    Linux Ubuntu 24.04.1
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 5810
    CPU
    Xeon 2680 v4
    Motherboard
    Xeon V4 Motherboard
    Memory
    64GB ECC DDR4
    Graphics Card(s)
    nVidia GTX 1650
    PSU
    850W
  • Operating System
    Windows 11 23H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 5810
    CPU
    Xeon 2680 V4
    Motherboard
    Dell Optiplex 5810 V4
    Memory
    32GB ECC
    Graphics card(s)
    nVidia Quadro M4000
So,

Are we seeing pages and pages of posts in this thread, because certain people don't know how to use Rufus, to create Win11 boot USB?

Or, is it because, OP wants to perform in place upgrade from W1123H2 to W1124H2, on "incompatible machine" !?

Read the thread?
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 23H2 Build 22631.4249
    Computer type
    PC/Desktop
    Manufacturer/Model
    Sin-built
    CPU
    Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (4th Gen?)
    Motherboard
    ASUS ROG Maximus VI Formula
    Memory
    32.0 GB of I forget and the box is in storage.
    Graphics Card(s)
    Gigabyte nVidia GeForce GTX 1660 Super OC 6GB
    Sound Card
    Onboard
    Monitor(s) Displays
    4 x LG 23MP75 - 2 x 24MK430H-B - 1 x Wacom Pro 22" Tablet
    Screen Resolution
    All over the place
    Hard Drives
    Too many to list.
    OS on Samsung 1TB 870 QVO SATA
    PSU
    Silverstone 1500
    Case
    NZXT Phantom 820 Full-Tower Case
    Cooling
    Noctua NH-D15 Elite Class Dual Tower CPU Cooler / 6 x EziDIY 120mm / 2 x Corsair 140mm somethings / 1 x 140mm Thermaltake something / 2 x 200mm Corsair.
    Keyboard
    Corsair K95 / Logitech diNovo Edge Wireless
    Mouse
    Logitech G402 / G502 / Mx Masters / MX Air Cordless
    Internet Speed
    100/40Mbps
    Browser
    All sorts
    Antivirus
    Kaspersky Premium
    Other Info
    I’m on a horse.
  • Operating System
    Windows 11 Pro 23H2 Build: 22631.4249
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO Yoga 7i EVO OLED 14" Touchscreen i5 12 Core 16GB/512GB
    CPU
    Intel Core 12th Gen i5-1240P Processor (1.7 - 4.4GHz)
    Memory
    16GB LPDDR5 RAM
    Graphics card(s)
    Intel Iris Xe Graphics Processor
    Sound Card
    Optimized with Dolby Atmos®
    Screen Resolution
    QHD 2880 x 1800 OLED
    Hard Drives
    M.2 512GB
    Other Info
    …still on a horse.
We all have our strengths and weaknesses.
In my opinion, and I am fairly confident that both strengths in regards to your questions have been met by members with adequate experience.

Reading the thread may (or may not) enable you to see something that others haven’t
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 23H2 Build 22631.4249
    Computer type
    PC/Desktop
    Manufacturer/Model
    Sin-built
    CPU
    Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (4th Gen?)
    Motherboard
    ASUS ROG Maximus VI Formula
    Memory
    32.0 GB of I forget and the box is in storage.
    Graphics Card(s)
    Gigabyte nVidia GeForce GTX 1660 Super OC 6GB
    Sound Card
    Onboard
    Monitor(s) Displays
    4 x LG 23MP75 - 2 x 24MK430H-B - 1 x Wacom Pro 22" Tablet
    Screen Resolution
    All over the place
    Hard Drives
    Too many to list.
    OS on Samsung 1TB 870 QVO SATA
    PSU
    Silverstone 1500
    Case
    NZXT Phantom 820 Full-Tower Case
    Cooling
    Noctua NH-D15 Elite Class Dual Tower CPU Cooler / 6 x EziDIY 120mm / 2 x Corsair 140mm somethings / 1 x 140mm Thermaltake something / 2 x 200mm Corsair.
    Keyboard
    Corsair K95 / Logitech diNovo Edge Wireless
    Mouse
    Logitech G402 / G502 / Mx Masters / MX Air Cordless
    Internet Speed
    100/40Mbps
    Browser
    All sorts
    Antivirus
    Kaspersky Premium
    Other Info
    I’m on a horse.
  • Operating System
    Windows 11 Pro 23H2 Build: 22631.4249
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO Yoga 7i EVO OLED 14" Touchscreen i5 12 Core 16GB/512GB
    CPU
    Intel Core 12th Gen i5-1240P Processor (1.7 - 4.4GHz)
    Memory
    16GB LPDDR5 RAM
    Graphics card(s)
    Intel Iris Xe Graphics Processor
    Sound Card
    Optimized with Dolby Atmos®
    Screen Resolution
    QHD 2880 x 1800 OLED
    Hard Drives
    M.2 512GB
    Other Info
    …still on a horse.
Read the thread?




I have "forced" myself, to read "the entire thread".

And now still wondering,

Why some people don't just wait, for the impending "official" Win 11 24H2 launch,
There plenty of guides, to be found on Google, on how to use Rufus, to burn MS ISO, to allow unsupported machine support,
Are people really trying to install/upgrade "incompatible PC", to Win 11/24H2, using original ISO dpwnloaded from MS?

Be assured, won't be following this thread.
 

My Computers

System One System Two

  • OS
    Linux Ubuntu 24.04.1
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 5810
    CPU
    Xeon 2680 v4
    Motherboard
    Xeon V4 Motherboard
    Memory
    64GB ECC DDR4
    Graphics Card(s)
    nVidia GTX 1650
    PSU
    850W
  • Operating System
    Windows 11 23H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 5810
    CPU
    Xeon 2680 V4
    Motherboard
    Dell Optiplex 5810 V4
    Memory
    32GB ECC
    Graphics card(s)
    nVidia Quadro M4000

My Computers

System One System Two

  • OS
    Windows 11 Pro 23H2 Build 22631.4249
    Computer type
    PC/Desktop
    Manufacturer/Model
    Sin-built
    CPU
    Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (4th Gen?)
    Motherboard
    ASUS ROG Maximus VI Formula
    Memory
    32.0 GB of I forget and the box is in storage.
    Graphics Card(s)
    Gigabyte nVidia GeForce GTX 1660 Super OC 6GB
    Sound Card
    Onboard
    Monitor(s) Displays
    4 x LG 23MP75 - 2 x 24MK430H-B - 1 x Wacom Pro 22" Tablet
    Screen Resolution
    All over the place
    Hard Drives
    Too many to list.
    OS on Samsung 1TB 870 QVO SATA
    PSU
    Silverstone 1500
    Case
    NZXT Phantom 820 Full-Tower Case
    Cooling
    Noctua NH-D15 Elite Class Dual Tower CPU Cooler / 6 x EziDIY 120mm / 2 x Corsair 140mm somethings / 1 x 140mm Thermaltake something / 2 x 200mm Corsair.
    Keyboard
    Corsair K95 / Logitech diNovo Edge Wireless
    Mouse
    Logitech G402 / G502 / Mx Masters / MX Air Cordless
    Internet Speed
    100/40Mbps
    Browser
    All sorts
    Antivirus
    Kaspersky Premium
    Other Info
    I’m on a horse.
  • Operating System
    Windows 11 Pro 23H2 Build: 22631.4249
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO Yoga 7i EVO OLED 14" Touchscreen i5 12 Core 16GB/512GB
    CPU
    Intel Core 12th Gen i5-1240P Processor (1.7 - 4.4GHz)
    Memory
    16GB LPDDR5 RAM
    Graphics card(s)
    Intel Iris Xe Graphics Processor
    Sound Card
    Optimized with Dolby Atmos®
    Screen Resolution
    QHD 2880 x 1800 OLED
    Hard Drives
    M.2 512GB
    Other Info
    …still on a horse.

Latest Support Threads

Back
Top Bottom