Win 11 Boot And Upgrade FiX KiT

Discussion in 'Windows 11' started by Enthousiast, Jun 28, 2021.

  1. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,023
    93,851
    450
    I and many others have been successfully upgrading to or clean installing 22000, 2262x and dev channel builds on ancient hardware, the problems you experience are not fix related.
     
  2. MDeaks

    MDeaks MDL Member

    Aug 25, 2017
    154
    74
    10
    For ME - worked on iNtel series 2 - 4 + plus AMD 3 series.

    Worked with "uup-downloaded" Windows 11-22H2 (one file with win11 pro to win11 server - ie full set of windows version"
    *** My preferred method/OPTION = via (fn+ f10- command prompt) than use = **Win_*11_Boot*_And_*Upgrade_FiX_KiT_v2.2.cmd**

    All of these series 3-5 intel were with OEM laptops with intel "drivers & firmware";
    and I noticed that you have to do these BEFORE DOING Win11:
    1) update BIOS to latest when available.
    2) update all INTEL DRIVERS + PLUS MUST DO FIRMWARE updates (preferably via use of "intel's driver/firmware update tools)
    3) Pre-download Manually "drivers for windows 11" of those Devices that often have issues eg - Display & Wireless 4G/5G drivers and or Fingerprint etc
    4) I personally DONT DELETE OEM Partition ( given that it often contained OEM drivers)

    Also note - installed (all on new SSD's) yes most all of them were installed originally with win7 OEM
    and now have Win11 ENTERPRISE and or EDUCATION.
    100+ laptops/Pc's and server/workstations installed and list growing.....

    ** Thanks to @Enthousiast , @abbodi1406 , @AveYo and others.***
     
  3. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,023
    93,851
    450
    ??
     
  4. MDeaks

    MDeaks MDL Member

    Aug 25, 2017
    154
    74
    10
    oops ... thats the "option" i used ... manually excute that "via " CMD
     
  5. MDeaks

    MDeaks MDL Member

    Aug 25, 2017
    154
    74
    10
    ** sorry for my bad english**
     
  6. W_fantasma

    W_fantasma MDL Senior Member

    Apr 10, 2012
    282
    234
    10
    there is not fn+ f10 option in the tool... :confused:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,023
    93,851
    450
    For some reason he opens cmd prompt with shift f10 to run the cmd.
     
  8. snofte

    snofte MDL Member

    Jan 10, 2013
    169
    30
    10
    Yes, for me it seems now that this "old driver problem" is caused by a flaw in the logic by MS when clean installing win 11.
    MS will, in some cases, find and install "old drivers" instead of more recent drivers. And then, later on in the install process, MS is
    refusing to accept driver(s) that they previously have selected !
    Example: Realtek lan driver selected is the 2015 version while latest driver from realtek is a 2022 version. . Same when clean installing w10.
    This 2015 version is ok for w10, but not for w11.
    I could not find any other way to avoid this problem, than to first clean install w10, then upgrade old drivers, then upgrade windows via the setup
    in a win 11 FIXED iso.
    Case closed.
     
  9. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,023
    93,851
    450
    I have almost completed the latest update of the original boot & upgrade fix tool:

    Code:
    
    ============================================================
    Win 11 Boot & Upgrade FiX KiT v4.0 By Enthousiast @MDL...
    ============================================================
    
    
    ================================================================================
    Select the desired FiX...
    ================================================================================
    
    [ 1 ] This option mainly utilizes UFWS v1.4 (recommended option).
    
    - It circumvents all Win 11 minimum requirements (CPU-RAM-Disksize-TPM-Secureboot).
    - This works for clean installs and upgrade scenarios using standard setup.
    - Integrates the Diskpart & Apply Image script (v1.3.1).
    - A generic EI.CFG file will be copied to the sources folder.
    
    ================================================================================
    
    [ 2 ] - This option modifies boot.wim registry to skip the SB, RAM, DiskSize and
     TPM 2.0 check and replaces "appraiserres.dll" with one from Win 10
     (You can insert your own in the Files folder, by default it's one from a 15063 ISO).
    - Integrates the Diskpart & Apply Image script (v1.3.1).
    - A generic EI.CFG file will be copied to the sources folder.
    
    This method enables you to:
    
    - Use the standard Win 11 setup for clean installs on devices without:
    - Secure Boot, TPM 2.0, DiskSize <52GB & RAM <8GB.
    - Use the alternative Diskpart & Apply Image installation script for clean installs.
    - Circumvent "TPM 2.0 is required" error when (inplace) upgrading.
    - Enables to install on LegacyBIOS/MBR only systems.
    - Circumvents the 64GB (52GB) minimum disk size check.
    
    ================================================================================
    
    [ 3 ] - This option modifies "winsetup.dll" inside boot.wim
    
    - It suppresses all Win 11 Hardware Requirements.
    - This works for clean installs and upgrade scenarios using standard setup.
    - Integrates the Diskpart & Apply Image script (v1.3.1).
    - A generic EI.CFG file will be copied to the sources folder.
    - replaces "appraiserres.dll" with one from Win 10
    - (You can insert your own in the Files folder, by default it's one from a 15063 ISO).
    
    ================================================================================
    
    This only applies to Option 1, 2 and 3!!!
    
    - For when public release (all Win 7/8/10) to DEV channel release ISO upgrades fails,
    - i've put in a cmd called "Upgrade_Fail_Fix.cmd", run this as admin,
    - after rebooting you can simply run standard setup.
    
    ================================================================================
    
    [ 4 ] - Puts the Win 11 install.wim/esd in a Win 10 ISO.
    (Provide a Win 10 ISO in the "Source_ISO\W10\" Folder).
    
    - This method is useful for clean installs from boot, using the standard W10 setup.
    - A generic EI.CFG file will be copied to the sources folder.
    
    ================================================================================
    
    * Type your option and press Enter:
    Changelog will be:
    Code:
    - Removed the combining of the UFWS with the Boot.wim registry fixex
    - Added the patching "winsetup.dll in boot.wim" method (thanks to @aveyo for the original snippet and @abbodi1406 for translating it to my level of coding :)
    
    WIll recheck all a few more times and upload as soon as i am satisfied:)
     
  10. stemic28

    stemic28 MDL Senior Member

    Aug 23, 2009
    285
    298
    10
    Integrates the Diskpart & Apply Image script (v1.3.1)

    is this still necessary?
     
  11. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,023
    93,851
    450
    It works fine for fast and easy (test) installs and you can disable the integration in the script settings.

    Plus as long as you don't do "SHIFT+F10" and type "menu" you won't even notice it being there.
     
  12. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,316
    7,023
    210
    Looks like that is exactly what I'm doing with 2.1, currently (to get around the stupid VB blockage). Guess I'll be able to update, then. ;)
    I suppose that method 2 does not disguise as Server?
     
  13. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,023
    93,851
    450
    Only the UFWS method uses "WINDOWS/INSTALLATIONTYPE=Server".

    I will send you the current script by convo, some info txt or checks will be modified but in general this is what it will be.
     
  14. gowaldi

    gowaldi MDL Novice

    Jul 3, 2016
    4
    0
    0
    Hello Enthousiast,
    how far is the development of version 4.

    greeting
    gowaldi
     
  15. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,023
    93,851
    450
    Later tonight if all goes right:)
     
  16. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,440
    1,420
    60
    #1057 rpo, Feb 4, 2023
    Last edited: Feb 6, 2023
    I really appreciate the work done to improve this application. The script may be improved by eliminating the redundant code to process the ei.cfg file Just move the relevant code after the RESUME2 label :
    Code:
    @echo off
    
    REM change wording if needed..
    TITLE Admin Check...
    echo Checking for admin...
    
    if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
    
    :gotAdmin
        pushd "%CD%"
        CD /D "%~dp0"
    cls
    ::Options to set by dev
    SET "Version=v4.0"
    SET "UFWS_version=v1.4"
    ::Options to set by the user
    SET "EI_CFG_ADD=0"
    SET "Boot_WIM_Opt=0"
    SET "DPaA=0"
    
    TITLE Win 11 Boot ^& Upgrade FiX KiT %version% By Enthousiast ^@MDL...
    
    ::Detect OS Architecture
    reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && ( set "arch=x86" ) || ( set "arch=x64" )
    
    if %arch%==x86 (
      set "_wimlib=bin\wimlib-imagex.exe"
      set "xOS=x86"
    ) else (
      set "_wimlib=bin\bin64\wimlib-imagex.exe"
      set "xOS=amd64"
    )
    
    :Preparing
    if exist "Work" rmdir /q /s "WORK"
    if exist "TEMP" rmdir /q /s "TEMP"
    
    md "WORK"
    md "TEMP"
    
    echo.
    echo ============================================================
    echo Win 11 Boot ^& Upgrade FiX KiT %version% By Enthousiast ^@MDL...
    echo ============================================================
    echo.
    
    :Loop
    SET "FiX="
    echo.
    echo=================================================================================
    ECHO Select the desired FiX...
    echo=================================================================================
    echo.
    ECHO [ 1 ] This option mainly utilizes UFWS %UFWS_version% (recommended option).
    ECHO.
    ECHO - It circumvents all Win 11 minimum requirements (CPU-RAM-Disksize-TPM-Secureboot).
    ECHO - This works for clean installs and upgrade scenarios using standard setup.
    IF /I "%DPaA%" NEQ "1" (
        ECHO - You have chosen to NOT integrate the Diskpart ^& Apply Image script ^(v1.3.1^).
    ) ELSE (
        ECHO - Integrates the Diskpart ^& Apply Image script ^(v1.3.1^).
    )
    IF /I "%EI_CFG_ADD%" NEQ "1" (
        ECHO - You have chosen to NOT copy the generic EI.CFG file.
    ) ELSE (
        ECHO - A generic EI.CFG file will be copied to the sources folder.
    )
    ECHO.
    echo=================================================================================
    ECHO.
    ECHO [ 2 ] - This option modifies boot.wim registry to skip the SB, RAM, DiskSize and
    ECHO  TPM 2.0 check and replaces ^"appraiserres.dll^" with one from Win 10
    ECHO  ^(You can insert your own in the Files folder, by default it's one from a 15063 ISO^).
    IF /I "%DPaA%" NEQ "1" (
        ECHO - You have chosen to NOT integrate the Diskpart ^& Apply Image script ^(v1.3.1^).
    ) ELSE (
        ECHO - Integrates the Diskpart ^& Apply Image script ^(v1.3.1^).
    )
    IF /I "%EI_CFG_ADD%" NEQ "1" (
        ECHO - You have chosen to NOT copy the generic EI.CFG file.
    ) ELSE (
        ECHO - A generic EI.CFG file will be copied to the sources folder.
    )
    ECHO.
    ECHO This method enables you to:
    echo.
    ECHO - Use the standard Win 11 setup for clean installs on devices without:
    ECHO - Secure Boot, TPM 2.0, DiskSize ^<52GB ^& RAM ^<8GB.
    ECHO - Use the alternative Diskpart ^& Apply Image installation script for clean installs.
    ECHO - Circumvent ^"TPM 2.0 is required^" error when ^(inplace^) upgrading.
    ECHO - Enables to install on LegacyBIOS^/MBR only systems.
    ECHO - Circumvents the 64GB ^(52GB^) minimum disk size check.
    ECHO.
    echo=================================================================================
    ECHO.
    ECHO [ 3 ] - This option modifies ^"winsetup.dll^" inside boot.wim
    ECHO.
    ECHO - It suppresses all Win 11 Hardware Requirements.
    ECHO - This works for clean installs and upgrade scenarios using standard setup.
    IF /I "%DPaA%" NEQ "1" (
        ECHO - You have chosen to NOT integrate the Diskpart ^& Apply Image script ^(v1.3.1^).
    ) ELSE (
        ECHO - Integrates the Diskpart ^& Apply Image script ^(v1.3.1^).
    )
    IF /I "%EI_CFG_ADD%" NEQ "1" (
        ECHO - You have chosen to NOT copy the generic EI.CFG file.
    ) ELSE (
        ECHO - A generic EI.CFG file will be copied to the sources folder.
    )
    echo - replaces "appraiserres.dll" with one from Win 10
    echo - (You can insert your own in the Files folder, by default it's one from a 15063 ISO).
    echo.
    echo=================================================================================
    ECHO.
    ECHO This only applies to Option 1, 2 and 3!!!
    echo.
    ECHO - For when public release (all Win 7/8/10) to DEV channel release ISO upgrades fails,
    ECHO - i've put in a cmd called "Upgrade_Fail_Fix.cmd", run this as admin,
    ECHO - after rebooting you can simply run standard setup.
    ECHO.
    echo=================================================================================
    ECHO.
    ECHO [ 4 ] - Puts the Win 11 install.wim/esd in a Win 10 ISO.
    ECHO (Provide a Win 10 ISO in the "Source_ISO\W10\" Folder).
    ECHO.
    ECHO - This method is useful for clean installs from boot, using the standard W10 setup.
    IF /I "%EI_CFG_ADD%" NEQ "1" (
        ECHO - You have chosen to NOT copy the generic EI.CFG file.
    ) ELSE (
        ECHO - A generic EI.CFG file will be copied to the sources folder.
    )
    ECHO.
    echo=================================================================================
    ECHO.
    SET "CHOICE="
    SET /P CHOICE="* Type your option and press Enter: "
    IF /I '%CHOICE%'=='1' SET "FiX=1"
    IF /I '%CHOICE%'=='2' SET "FiX=2"
    IF /I '%CHOICE%'=='3' SET "FiX=3"
    IF /I '%CHOICE%'=='4' SET "FiX=4"
    
    IF NOT DEFINED FiX GOTO :Loop
    
    if not exist "Source_ISO\W11\*.iso" (
    echo.
    ECHO==========================================================
    echo No iso file detected in Source_ISO^\W11 dir...
    ECHO==========================================================
    echo.
    GOTO :cleanup
    )
    
    IF /I "%FiX%" NEQ "4" GOTO :RESUME1
    
    if not exist "Source_ISO\W10\*.iso" (
    echo.
    ECHO==========================================================
    echo No iso file detected in Source_ISO^\W10 dir...
    ECHO==========================================================
    echo.
    GOTO :cleanup
    )
    
    :RESUME1
    
    for /f "delims=" %%i in ('dir /b Source_ISO\W11\*.iso') do bin\7z.exe e -y -oTEMP "Source_ISO\W11\%%i" sources\setup.exe >nul
    bin\7z.exe l .\TEMP\setup.exe >.\TEMP\version.txt 2>&1
    for /f "tokens=4 delims=. " %%i in ('findstr /i /b FileVersion .\TEMP\version.txt') do set vermajor=%%i
    
    bin\7z.exe l .\Files\appraiserres.dll >.\TEMP\version2.txt 2>&1
    for /f "tokens=4 delims=. " %%i in ('findstr /i /b FileVersion .\TEMP\version2.txt') do set Appraiserres_Version=%%i
    
    for /f "tokens=4,5 delims=. " %%i in ('findstr /i /b FileVersion .\TEMP\version.txt') do (set majorbuildnr=%%i&set deltabuildnr=%%j)
    
    IF NOT DEFINED vermajor (
    if exist "TEMP" rmdir /q /s "TEMP"
    echo.
    ECHO==========================================================
    echo Detecting setup.exe version failed...
    ECHO==========================================================
    echo.
    pause
    exit /b
    )
    
    SET "Winver="
    
    IF %vermajor% GEQ 19041 SET "Winver=10"
    IF %vermajor% GEQ 21996 SET "Winver=11"
    
    
    IF NOT DEFINED Winver (
    if exist "TEMP" rmdir /q /s "TEMP"
    echo.
    ECHO==========================================================
    echo Unsupported iso version...
    ECHO==========================================================
    echo.
    pause
    exit /b
    )
    
    IF %vermajor% GEQ 21996 SET "BUILD=22000"
    
    IF NOT DEFINED BUILD (
    echo.
    ECHO==========================================================
    echo Unsupported Win10 build...
    ECHO==========================================================
    echo.
    pause
    exit /b
    )
    
    If /I "%FiX%"=="4" GOTO :FiX4
    
    echo.
    ECHO==========================================================
    echo Extracting Source ISO...
    ECHO==========================================================
    echo.
    bin\7z x -y -oWork\ Source_ISO\W11\
    echo.
    Goto :RESUME2
    
    :FiX4
    echo.
    echo ============================================================
    echo Extracting Win 10 Source ISO...
    echo ============================================================
    echo.
    bin\7z x -y -oWork\ Source_ISO\W10\ -x!sources\install.*
    echo.
    echo ============================================================
    echo Extracting Win 11 install.wim^/esd to work dir...
    echo ============================================================
    echo.
    for /f %%i in ('dir /b Source_ISO\W11\*.iso') do bin\7z.exe e -y -o"WORK\Sources" "Source_ISO\W11\%%i" sources\install.* >nul
    :RESUME2
    
    IF /I "%EI_CFG_ADD%" NEQ "1" (
    echo ============================================================
    ECHO You have chosen to NOT copy the generic EI.CFG file.
    ECHO.
    echo ^(If exists, the original file will remain on the ISO^)
    echo ============================================================
    ECHO.
    ) else (
    echo.
    echo ============================================================
    echo Copying the generic ei.cfg to the work dir...
    echo ^(If exists, the original file will be renamed to EI.CFG.Ori^)
    echo ============================================================
    echo.
    IF EXIST "WORK\Sources\EI.CFG" ren "WORK\Sources\EI.CFG" "EI.CFG.Ori"
    COPY /Y "Files\EI.CFG" "WORK\Sources\"
    echo.
    )
    
    if exist "Work\sources\install.wim" set WIMFILE=install.wim
    if exist "Work\sources\install.esd" set WIMFILE=install.esd
    
    if exist "Work\sources\install.swm" (
    echo ============================================================
    echo Install.swm file is not supported...
    echo ============================================================
    echo.
    goto :cleanup
    )
    
    REM detect wim arch
    : detectwimarch
    for /f "tokens=2 delims=: " %%# in ('dism.exe /english /get-wiminfo /wimfile:"Work\sources\%WIMFILE%" /index:1 ^| find /i "Architecture"') do set warch=%%#
    
    for /f "tokens=3 delims=: " %%m in ('dism.exe /english /Get-WimInfo /wimfile:"Work\sources\%WIMFILE%" /Index:1 ^| findstr /i Build') do set b2=%%m
    
    :Win11Lang
    REM detect extracted win11 iso language
    set "IsoLang=ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,en-US,es-ES,es-MX,et-EE,fi-FI,fr-CA,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-TW"
    for %%i in (%IsoLang%) do if exist "Work\sources\%%i\*.mui" set %%i=1
    
    REM set ISO label lang
    for %%i in (%IsoLang%) do if defined %%i (
    SET "LabelLang=%%i"
    )
    
    If /I "%FiX%"=="4" GOTO :ISO_FiX4
    IF /I "%FiX%"=="3" GOTO :FIX3
    IF /I "%FiX%"=="2" GOTO :FIX2
    
    :FiX1
    echo.
    echo ============================================================
    Echo Applying UFWS %UFWS_version% to circumvent CPU-RAM-Disksize-TPM-Secureboot checks to %WIMFILE%
    echo ============================================================
    for /f "tokens=3 delims=: " %%i in ('%_wimlib% info Work\sources\%WIMFILE% ^| findstr /c:"Image Count"') do set images=%%i
    for /L %%i in (1,1,%images%) do (
      %_wimlib% info "Work\sources\%WIMFILE%" %%i --image-property WINDOWS/INSTALLATIONTYPE=Server >nul
    )
    echo.
    Goto :ISO_FiX123
    
    :FIX2
    echo.
    echo ============================================================
    echo Modding Boot.wim to disable Secure Boot, RAM, DiskSize and TPM 2.0 check...
    echo ============================================================
    echo.
    ::if exist "TEMP" rmdir /q /s "TEMP"
    
    %_wimlib% extract "WORK\sources\boot.wim" 2 \Windows\System32\config\SYSTEM --no-acls --no-attributes --dest-dir="TEMP"
    
    Reg.exe load HKLM\MDL_Test "TEMP\SYSTEM"
    Reg.exe add "HKLM\MDL_Test\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d "1" /f
    Reg.exe add "HKLM\MDL_Test\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d "1" /f
    Reg.exe add "HKLM\MDL_Test\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d "1" /f
    Reg.exe add "HKLM\MDL_Test\Setup\LabConfig" /v "BypassStorageCheck" /t REG_DWORD /d "1" /f
    Reg.exe unload HKLM\MDL_Test
    
    %_wimlib% update "WORK\sources\boot.wim" 2 --command="add 'TEMP\SYSTEM' '\Windows\System32\config\SYSTEM'"
    echo.
    echo ============================================================
    echo Replacing the Win 11 appraiserres.dll with one from a %Appraiserres_Version% ISO...
    echo ^(The original file will be renamed to appraiserres.dll.bak^)
    echo ============================================================
    echo.
    ren "WORK\sources\appraiserres.dll" "appraiserres.dll.bak"
    copy /Y "Files\appraiserres.dll" "WORK\Sources"
    echo.
    Goto :ISO_FiX123
    
    :FIX3
    echo.
    echo ============================================================
    echo Modding Boot.wim winsetup.dll to disable HWRequirements check...
    echo ============================================================
    echo.
    ::if exist "TEMP" rmdir /q /s "TEMP"
    
    %_wimlib% extract "WORK\sources\boot.wim" 2 \sources\winsetup.dll --no-acls --no-attributes --dest-dir="TEMP"
    
    set "d1=$winsetup = 'TEMP\winsetup.dll'; $b = [io.file]::ReadAllBytes($winsetup); $h = [BitConverter]::ToString($b) -replace '-'"
    set "d2=$s = [BitConverter]::ToString([Text.Encoding]::Unicode.GetBytes('Module_Init_HWRequirements')) -replace '-'"
    set "d3=$i = ($h.IndexOf($s)/2); $r = [Text.Encoding]::Unicode.GetBytes('Module_Init_GatherDiskInfo'); $l = $r.Length"
    set "d4=if ($i -gt 1) {for ($k=0;$k -lt $l;$k++) {$b[$i+$k] = $r[$k]}; [io.file]::WriteAllBytes($winsetup,$b)}; [GC]::Collect()"
    powershell -nop -c "%d1%; %d2%; %d3%; %d4%"
    
    %_wimlib% update "WORK\sources\boot.wim" 2 --command="add 'TEMP\winsetup.dll' '\sources\winsetup.dll'"
    echo.
    echo ============================================================
    echo Replacing the Win 11 appraiserres.dll with one from a %Appraiserres_Version% ISO...
    echo ^(The original file will be renamed to appraiserres.dll.bak^)
    echo ============================================================
    echo.
    ren "WORK\sources\appraiserres.dll" "appraiserres.dll.bak"
    copy /Y "Files\appraiserres.dll" "WORK\Sources"
    echo.
    echo.
    Goto :ISO_FiX123
    
    :ISO_FiX123
    IF /I "%DPaA%" NEQ "1" GOTO :RESUME3
    echo.
    echo ============================================================
    echo Adding Murphy78 Diskpart and Apply Image Script 1.3.1 To Boot.wim...
    echo ============================================================
    echo.
    %_wimlib% update Work\sources\boot.wim 2 --command "add 'Files\murphy78-DiskPart-Apply-v1.3.1\%warch%\' '\'"
    :RESUME3
    echo.
    echo ============================================================
    echo Copying Upgrade_Fail_Fix.cmd to work dir...
    echo ============================================================
    echo.
    COPY /Y "Files\Upgrade_Fail_Fix.cmd" "WORK\"
    echo.
    IF /I "%Boot_WIM_Opt%" NEQ "1" GOTO :SKIP_2
    echo ============================================================
    echo Optimizing boot.wim...
    echo ============================================================
    echo.
    %_wimlib% optimize "WORK\Sources\boot.wim" --recompress
    :SKIP_2
    echo.
    ECHO==========================================================
    echo Creating %WARCH% ISO...
    ECHO==========================================================
    echo.
    ECHO.
    xcopy /s /i /Q "OEM" "WORK\Sources" >NUL 2>&1
    ECHO.
    for /f %%# in ('powershell "get-date -format _yyyy_MM_dd"') do set "isodate=%%#"
    if not defined isodate set "isodate=_0000_00_00"
    echo.
    for /f "delims=" %%i in ('dir /b Source_ISO\W11\*.iso') do set "isoname=%%i"
    set "isoname=%isoname:~0,-4%_FIXED%isodate%.iso"
    bin\cdimage.exe -bootdata:2#p0,e,b"Work\boot\etfsboot.com"#pEF,e,b"Work\efi\Microsoft\boot\efisys.bin" -o -m -u2 -udfver102 -lWin_%Winver%_%vermajor%_%warch%_%LabelLang% "work" "%isoname%"
    Goto :cleanup
    
    :ISO_FiX4
    IF /I "%Boot_WIM_Opt%" NEQ "1" GOTO :SKIP_3
    echo ============================================================
    echo Optimizing boot.wim...
    echo ============================================================
    echo.
    %_wimlib% optimize "WORK\Sources\boot.wim" --recompress
    :SKIP_3
    echo.
    ECHO==========================================================
    echo Creating %WARCH% ISO...
    ECHO==========================================================
    echo.
    for /f %%# in ('powershell "get-date -format _yyyy_MM_dd"') do set "isodate=%%#"
    if not defined isodate set "isodate=_0000_00_00"
    echo.
    bin\cdimage.exe -bootdata:2#p0,e,b"Work\boot\etfsboot.com"#pEF,e,b"Work\efi\Microsoft\boot\efisys.bin" -o -m -u2 -udfver102 -lWin_%Winver%_%vermajor%_%warch%_%LabelLang% "Work" Win_10_ISO_With_%majorbuildnr%.%b2%_%wARCH%_%LabelLang%_%WIMFILE%_FiXED%isodate%.iso
    
    :cleanup
    if exist "TEMP" rmdir /q /s "TEMP"
    if exist "Work" rmdir /q /s "WORK"
    
    pause
    exit /b

    Caveats when using IF blocks :
    • Don't use :: for comments but rem
    • When defining variables, use setlocal ENABLEDELAYEDEXPANSION and replace %variable% by !variable! for these variables
     
  17. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,023
    93,851
    450
    @rpo
    Not seeing reports it is not working as it is now but will I look into it asap:)
     
  18. rpo

    rpo MDL Expert

    Jan 3, 2010
    1,440
    1,420
    60
    You misunderstood. The script is perfectly working as it is now. I only propose to eliminated redundant coding. This can be achieved here just by deplacing the ei.cfg block (in other situations, use subroutines).
    BTW, I suggest replacing the statement at line 7 by :
    Code:
    reg query HKU\S-1-5-19 >nul 2>&1 ||if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
    
    to avoid reentering the script if you execute it as admin.
     
  19. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,023
    93,851
    450
    @rpo

    The ei.cfg stuff could also be put after :ISO_FiX123 and then it is only needed to be in just once but i was lazy and it worked, so i left it as it was, next time i will try to clean it up a bit.