Recovery Project with Boot Mode Support

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

  1. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    60
    #1 Chibi ANUBIS, Jun 29, 2016
    Last edited: Jun 12, 2021
    HELLO !
    Is my automatic setup for the Recovery Project by AnarethoS for Windows 10, 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 10 Recovery".
    Work also for Windows 7, 8, 8.1 with the pach boot.wim but use the recovery software used by the system.


    WINDOWS 10 - ALL BUILDS DOWNLOAD
    RECOVERY PROJECT MDL BUILD 2106
    RECOVERY PROJECT MDL BUILD 2106 OEM
    OLDS WINDOWS DOWNLOAD
    Recovery Tools for Windows 7
    Recovery Tools for Windows 8-8.1
    VERSION 2 :
    • Include my BIOS Mode detection.
    • Include ScanState.
    • Include ReadMe for installation.
    • Include OEM Recovery Partition Creator already prepare for MBR and EFI.
    • Include AddOn folder with : ESET Online Scanner and Yamicsoft Windows 10 Manager.
    REMEMBER : sysprep.cmd at need a confirmation to delete or not AddOn before the capture.

    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. You can see the demonstration here.


    WHAT'S NEW :
    + OEM Recovery Partition updated to version 5.0.0
    + ESET Online updated to 3.5.6.0
    + Yamicsoft Windows 10 Manager updated to 3.5.0
    + OEM Info Updater updated to 9.4
    Voilà ! :)

    Use the ReadMe to prepare your installation,
    Now you can just install software and driver and then launch "sysprep.cmd" and everything is ready.

    I made this project to save on DVD since I was four with two more the recovery architecture or two if I make an AIO, now one is enough, and even more by USB it works it's really cool !

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


    MORE TRICKS ! POST NUMBER
    Detection of BIOS Mode
    Demonstration of my Recovery Project for Windows 10
    Prepare Windows 10 ISO with my Recovery Project

    DON'T FORGET LIKE THIS POST ! :clap:

    [​IMG]
     
  2. wk-952

    wk-952 MDL Member

    Joined:
    Sep 2, 2012
    Messages:
    116
    Likes Received:
    286
    Trophy Points:
    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

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    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.
     
  4. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    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 :(
     
  5. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    60
    #5 Chibi ANUBIS, Jun 29, 2016
    Last edited: Dec 16, 2019
    (OP)
    Pictures link dead...
     
  6. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    60
    IS FIXED !
    I missed he exist two setup.exe ... :eek:
     
  7. wk-952

    wk-952 MDL Member

    Joined:
    Sep 2, 2012
    Messages:
    116
    Likes Received:
    286
    Trophy Points:
    10
    Could you please explain further what was the issue ?
    I'm very curious about this.
     
  8. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    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.
     
  9. mehdibleu

    mehdibleu MDL Expert

    Joined:
    Jun 14, 2017
    Messages:
    1,009
    Likes Received:
    248
    Trophy Points:
    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

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    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
     
  11. mehdibleu

    mehdibleu MDL Expert

    Joined:
    Jun 14, 2017
    Messages:
    1,009
    Likes Received:
    248
    Trophy Points:
    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

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    60
    In French is only message private please :)
     
  13. amulder31

    amulder31 MDL Novice

    Joined:
    Apr 30, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    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

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    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 :)
     
  15. amulder31

    amulder31 MDL Novice

    Joined:
    Apr 30, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hello Chibi ANUBIS,
    Thank you very much I will try with your script good Sunday
     
  16. pacoolio

    pacoolio MDL Junior Member

    Joined:
    Jun 10, 2009
    Messages:
    98
    Likes Received:
    87
    Trophy Points:
    0
    Is there an easier method to integrate all of this script in Windows 7 OEM ?
     
  17. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    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 :)
     
  18. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    60
    #18 Chibi ANUBIS, Dec 29, 2018
    Last edited: Jun 12, 2021
    (OP)
    RESERVED
     
  19. JeepWillys58

    JeepWillys58 MDL Senior Member

    Joined:
    Nov 6, 2010
    Messages:
    334
    Likes Received:
    151
    Trophy Points:
    10
    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.
     
  20. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    60
    Hello my friend, is the same method. Is work for all Windows 10 Edition.