Recovery Project with Boot Mode Support

Discussion in 'Scripting' started by Chibi ANUBIS, Jun 29, 2016.

  1. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    #1 Chibi ANUBIS, Jun 29, 2016
    Last edited: Apr 23, 2024 at 19:16
    HELLO !
    Is my automatic setup for the Recovery Project by AnarethoS for Windows 1X, is now possible to use two AutoUnattend xml files (MBR and EFI) for create a recovery partition.

    Indeed it is an "smart" script that identifies whether it should start the AutoUnattend files for MBR or EFI, I'll explain here, I used the folder "Windows 1X Recovery".

    NEW ! Support POWIS for Windows 10 build 19041 and later, for DaRT don't forget to put the same Debugger from the SDK like your winre/boot build.
    BUILD WINDOWS 1X RECOVERY DOWNLOAD
    22H2/23H2 Recovery Project Build 22621 OEM
    2004/20H2/21H1/21H2/22H2 Recovery Project Build 19041 OEM
    BUILD RECOVERY FOR POWIS DOWNLOAD
    2004/20H2/21H1/21H2/22H2 RPBS for POWIS 19041 OEM
    Diagnostics and Recovery Toolset DaRT 10 Integration French
    WHAT IS IT :
    • Include ReadMe for installation.
    • Include Boot Mode detection.
    • Include OEM Recovery Partition Creator.
    • Include ScanState.
    • Inlcude OEM Information Updater.
    • Include AddOn softwares with Yamicsoft Windows 1X Manager.

    About the OEM Edition :
    Allows you to install the information and theme of your computer's brand like the computers put for resale. Or you can custom OEM informations.


    Use the ReadMe to prepare your installation,
    Now you can just install software and driver and then launch "setup.cmd" and everything is ready.
    You can use my script to check if you are in UEFI or MBR : Post-26

    I hope I was clear enough if need does not hesitate to comeback to ask me anything at all.


    DON'T FORGET TO LIKE THIS POST ! :clap:
    TIME TO TAKE A BREAK !
    [​IMG]
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. wk-952

    wk-952 MDL Member

    Sep 2, 2012
    116
    287
    10
    #2 wk-952, Jun 29, 2016
    Last edited by a moderator: Apr 20, 2017
    This is not a solution to your problem but something worth mentioning.
    You are using the exclamation mark to expand variables (delayed variable expansion):
    Code:
    if !Firmware!==0x1 set UEFI=0
    if !Firmware!==0x2 set UEFI=1
    if !UEFI! EQU 1 (
    
    But you don't seem to enable delayed variable expansion at the beginning of your script after the line "@echo off"
    so you're comparing the string "!UEFI!" (literally as it is like that) against the number one, which of course will always be false.

    As for your original problem, are you sure the file "MBR.xml" exists in the root directory of the setup ?
     
  3. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    #3 Chibi ANUBIS, Jun 29, 2016
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Thank you wk-952 :)

    My file xml exist in the root of directory but the setup not found "X:\MBR.xml not found" I test on VMware.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    #4 Chibi ANUBIS, Jun 29, 2016
    Last edited by a moderator: Apr 20, 2017
    (OP)
    I updated :
    Code:
    @echo off
    SetLocal EnableDelayedExpansion
    
    FOR %%i IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\setup.exe SET Install=%%i:
    
    :Lastly do the UEFI detection
    :Check whether user has booted with UEFI or BIOS and set UEFI=1 if UEFI
    wpeutil UpdateBootInfo
    for /f "tokens=2* delims=     " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET Firmware=%%B
    :: Note: delims is a TAB followed by a space.
    if !Firmware!==0x1 set UEFI=0
    if !Firmware!==0x2 set UEFI=1
    
    if !UEFI! EQU 1 ( 
    %install%\setup.exe /unattend:%install%\EFI.xml /m:%install%\sources\EFI
    ) ELSE (
    %install%\setup.exe /unattend:%install%\MBR.xml /m:%install%\sources\MBR
    )
    exit
    And is the same error :(
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    #5 Chibi ANUBIS, Jun 29, 2016
    Last edited: Dec 16, 2019
    (OP)
    Pictures link dead...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    IS FIXED !
    I missed he exist two setup.exe ... :eek:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. wk-952

    wk-952 MDL Member

    Sep 2, 2012
    116
    287
    10
    Could you please explain further what was the issue ?
    I'm very curious about this.
     
  8. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60

    I realized after the boot.wim back that there were also a setup.exe, so logically the script that had the search will take this one and not that of the DVD and then can not find the xml file as it is in the DVD and not the boot.wim.

    To solve the problem I ask him to look for another file that does not exist in the boot.wim but only on DVD and there attribute the correct drive letter to start the xml file.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. mehdibleu

    mehdibleu MDL Expert

    Jun 14, 2017
    1,009
    251
    60
    #9 mehdibleu, Aug 21, 2017
    Last edited: Aug 21, 2017
    thank you for that script, it is a really smart script that allows to boot either from BIOS(MBR) or EFI according to user's bios configuration.
    I've tested it and it works great.

    And as i see but i'm not sure about this, you adjusted this script to be able to save time as you can directly lauch "sysprep.cmd" to capture the image after the installation of win10 is finished.

    if i'm correct, you tested this script on win10 configuration but i suppose that you can use it for all other windows versions.

    So back to the point i've just mentionned above, what about "install - windows 10.cmd" that you normally have to launch before "sysprep.cmd" in @AnarethoS script project ?
    did you adjust your script to be able to skip "install - windows 10.cmd" and run only "sysprep.cmd" ?
    or do you have to run "install - windows 10.cmd" as well before "sysprep.cmd" with your script to be able to make this work ?

    in other words, is it necessary to lauch "install - windows 10.cmd" just before running "sysprep.cmd" with your script ? or it is not necessary to launch "install - windows 10.cmd" anymore using your script ?
     
  10. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    Thank you I'm glad to see your comment :)
    My script works for all Windows, it is possible to remove "/m:%install%\sources\EFI" If you do not need to move a Recovery folder. Indeed with this method it is not necessary to run "Install - Windows 10.cmd" as the folder in question is already installed, you just have to put "ResetConfig.xml" of the Settings folder in the Recovery OEM folder before launching Sysprep.exe. The only difference is that the Recovery folder will not have the assignments that it gives "Install - Windows 10.cmd":
    Code:
    ATTRIB -S -R -H C:\Recovery
    ATTRIB -S -R -H C:\Recovery /S
    icacls C:\Recovery /reset /T /C
    icacls C:\Recovery /inheritance:r /grant:r SYSTEM:(OI)(CI)(F) /grant:r *S-1-5-32-544:(OI)(CI)(F) /grant:r *S-1-5-32-545:(OI)(CI)(RX) /C
    ATTRIB +S +H C:\Recovery
    
    VoilĂ  ! :D
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. mehdibleu

    mehdibleu MDL Expert

    Jun 14, 2017
    1,009
    251
    60
    thank you for the reply but i didn't get the last sentence , what do you mean by "The only difference is that the Recovery folder will not have the assignments that it gives "Install - Windows 10.cmd".
    i see that you speak french, that's good news for me as i speak french as well, so if you could explain what you meant in this last sentence in french, that would be nice.:)
     
  12. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    In French is only message private please :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. amulder31

    amulder31 MDL Novice

    Apr 30, 2017
    2
    0
    0
    Hello Chibi Anubis,
    I would be interested in your script edit as you did I try to do it without success it would be very nice to share it I'm also in France
    In advance thank you very much for your sharing
    cordially
    Amulder
     
  14. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    #14 Chibi ANUBIS, Dec 2, 2017
    Last edited: Dec 24, 2017
    (OP)
    Hello amulder31,
    I haven't files, is simply follow the post and download the OEM project by AnarethoS, It must be prepared before, I updated my thread, please tell me if you understand the process :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. amulder31

    amulder31 MDL Novice

    Apr 30, 2017
    2
    0
    0
    Hello Chibi ANUBIS,
    Thank you very much I will try with your script good Sunday
     
  16. pacoolio

    pacoolio MDL Member

    Jun 10, 2009
    121
    104
    10
    Is there an easier method to integrate all of this script in Windows 7 OEM ?
     
  17. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    #17 Chibi ANUBIS, Apr 9, 2018
    Last edited: Feb 25, 2020
    (OP)
    Hello ! For Windows 7 and Windows 8-8.1, you just need to prepare the install.cmd for partitioning your hard drive :
    Just remove the /m argument like : /m:%install%\sources\EFI and /m:%install%\sources\MBR

    Windows 7 IS ONLY FOR x64 !
    Because x86 don't run EFI, you don't need to patch the boot.wim, just put the MBR autounattend.xml

    winpeshl.ini
    Code:
    [LaunchApps]
    %SYSTEMDRIVE%\windows\system32\install.cmd
    
    install.cmd
    Code:
    @echo off
    SetLocal EnableDelayedExpansion
    
    FOR %%i IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\efi.xml SET install=%%i:
    
    :Lastly do the UEFI detection
    :Check whether user has booted with UEFI or BIOS and set UEFI=1 if UEFI
    wpeutil UpdateBootInfo
    for /f "tokens=2* delims=     " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET Firmware=%%B
    :: Note: delims is a TAB followed by a space.
    if !Firmware!==0x1 set UEFI=0
    if !Firmware!==0x2 set UEFI=1
    
    if !UEFI! EQU 1 (
    %install%\setup.exe /unattend:%install%\efi.xml
    ) ELSE (
    %install%\setup.exe /unattend:%install%\mbr.xml
    )
    exit
    
    And Copy/Paste the Recovery folder in the root of your ISO, and copy this script Detection BIOS Mode in the Recovery folder. Rename Installer folder to GPT and MBR, this script will copy the folder in desktop, work also with Windows 8-8.1 :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    #18 Chibi ANUBIS, Dec 29, 2018
    Last edited: Jun 12, 2021
    (OP)
    RESERVED
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. JeepWillys58

    JeepWillys58 MDL Addicted

    Nov 6, 2010
    581
    365
    30
    Hi Dear @Chibi ANUBIS ,

    There is a step-by-step to do it on the Windows 10 Enterprise LTSC 2019 comp 1809 17763.253?

    Thanks in advanced.

    Regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  20. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,237
    911
    60
    Hello my friend, is the same method. Is work for all Windows 10 Edition.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...