murphy78 DiskPart and Apply Image Script

Discussion in 'Scripting' started by murphy78, Apr 2, 2014.

  1. mehdibleu

    mehdibleu MDL Expert

    Jun 14, 2017
    1,008
    251
    60
    sorry but i don't seem to understand what you say and i don't think it responds to my question.
    Adding winrecfg to boot.wim allows you to use recovery options, my question is what is the point of using winrecfg for win8 and win10 when recovery options are already integrated by Microsoft into win8 and win10 ?
    if you install win8 or win10 then want to resetpc later, you logically don't need to use these winrecfg cabs, resetpc procedure will end successfully as recovery options are present by default in win8 and win10.
     
  2. Flipp3r

    Flipp3r MDL Guru

    Feb 11, 2009
    2,021
    970
    90
    Well if you've scripted your partition creation & install you could also setup winre from winpe, ie:
    Code:
    W:\Windows\System32\reagentc /setreimage /path R:\Recovery\WindowsRE /target W:\Windows
    Custom tool:
    Code:
    W:\Windows\System32\Reagentc /setbootshelllink /configfile R:\Recovery\WindowsRE\AddDiagnosticsToolToBootMenu.xml /target W:\Windows
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. mehdibleu

    mehdibleu MDL Expert

    Jun 14, 2017
    1,008
    251
    60
    #183 mehdibleu, Aug 3, 2017
    Last edited: Aug 12, 2017
    ok, after doing different tests, i have reached the conclusion that installing win8.1 without the script will prevent you of using recovery options so to change this situation, you have to install win8.1 with murphy78's script and this way you will be able to use recovery options to i.e resetpc.

    As i said above, to be able to use resetpc option for example, you have to use murphy's script and integrate winrecfg into boot.wim and install windows with the recovery partition , then and only then you will be able to use recovery options to restore your windows version successfully.

    here are the different tests i made to reach that conclusion :

    i installed win8.1 without using the script => reset pc failed.
    i installed win8.1 using the script, didn't integrate winrecfg and installed windows without recovery partition => resetpc failed.
    i installed win8.1 using the script, didn't integrate winrecfg and installed windows with recovery partition => resetpc failed.
    i installed win8.1 using the script, integrate winrecfg and installed windows without recovery partition => resetpc failed.
    i installed win8.1 using the script, integrate winrecfg and installed windows with recovery partition => resetpc worked.

    @murphy78 , now i know what you meant in your previous post by saying that winrecfg is used to replace reagentc, thank you again for your great work here.
     
  4. Flipp3r

    Flipp3r MDL Guru

    Feb 11, 2009
    2,021
    970
    90
    Did you look at murphy78's script? Look familiar:
    Code:
    winrecfg /setreimage /path W:\Recovery\WindowsRE /target Z:\Windows /bootkey 3b00
    3b00 is F1, 3c00 is scancode for F2 etc...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. mehdibleu

    mehdibleu MDL Expert

    Jun 14, 2017
    1,008
    251
    60
    #185 mehdibleu, Aug 4, 2017
    Last edited: Aug 4, 2017
    yes i saw that he mentionned that in OP and it didn't work for win8.1, when i installed win8.1 using the script with recovery partition ( added winrecfg into boot.wim), i didn't manage to access recovery options by pressing F1, when i press F1 nothing happens.

    On the other hand, it worked for win7, i took win7 install.esd file then integrated it into win8.1 iso as win7 does not support esd files and after doing the same procedure, i managed to access recovery options by pressing F1 but it didn't work for win8.1 for unknown reason.

    But i was able to access recovery options with win8.1 anyway through F8 key by reenabling boot menu with this command (boot menu through F8 was disabled by default in win8.1) :

    Code:
    bcdedit /set {default} bootmenupolicy legacy
    you restart your machine and you press F8 then you have this menu to appear with "repair your computer" option as you can see below :

    [​IMG]

    Choosing "repair your computer" option allowed me to access to recovery options and you can use at this moment resetpc option to restore your system, the procedure works and ends successfully but again as i said in my previous post, to make resetpc work, you have to add winrecfg cab files into boot.wim and choose to install windows with the recovery partition using the script and only then you will be able to use recovey options successfully.
     
  6. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,428
    11,759
    240
    It's to set both the winre and recovery partition if available.
    I don't believe Windows will know where the winre.wim is located if you move it to a different partition.
    It's possible that it automatically assigns it during first boot if you never move it.
     
  7. mehdibleu

    mehdibleu MDL Expert

    Jun 14, 2017
    1,008
    251
    60
    #187 mehdibleu, Aug 10, 2017
    Last edited: Aug 12, 2017
    i don't get your point, why would i move windows to another partition ?
    in other words, for what reason people would move windows to another partition ?
     
  8. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,428
    11,759
    240
    Not what I said.
    You can move the winre.wim from the standard system32\recovery folder to anywhere you wish.
    Windows normally moves it to a different partition during setup and then sets the recovery boot options appropriately.
    My script also moves the winre.wim to a different partition by default.
     
  9. mehdibleu

    mehdibleu MDL Expert

    Jun 14, 2017
    1,008
    251
    60
    #189 mehdibleu, Aug 13, 2017
    Last edited: Aug 13, 2017
    ok, in that case, why would someone move winre.wim to somewhere else or to another partition ?
    For what reason would someone do that ?

    btw, i edited one of my previous posts after doing again different tests so i corrected it by removing then adding new information => https://forums.mydigitallife.net/th...apply-image-script.53532/page-10#post-1362176
     
  10. Flipp3r

    Flipp3r MDL Guru

    Feb 11, 2009
    2,021
    970
    90
    Most people would want the Microsoft recommend partition layout - which has the winre.wim in it's own partition marked with the ID as a Recovery.
    For UEFI, see: https://docs.microsoft.com/en-us/wi...configure-uefigpt-based-hard-drive-partitions
    [​IMG]
    Since your using scripts, you can easily change the layout, add data partitions, dual boot, etc...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. Tiger-1

    Tiger-1 MDL Guru

    Oct 18, 2014
    7,894
    10,735
    240
    @ Flipp3r very good information dude, myself also learn there :D
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. mehdibleu

    mehdibleu MDL Expert

    Jun 14, 2017
    1,008
    251
    60
    yes, i got that but what difference would it make since installaing windows 10 without the script leads to the same result ? namely, people will be able to use recovery options (i.e resetpc) with ot without using the script.
    The script is useful when it comes to install win7 or win8 as recovery options are not included for win7 and need disk support for win8.1, in these 2 cases, the script is very useful as it allows you to create recovery partition to be able to use it later to use recovery options to i.e resetpc successfully for win8.1 or to reinstall widows for win7.
    But for win10, people don't need to use the script to use recovery options as they are included by default in win10 and you can use theses recovery options to resetpc at any time without the script and without extra disk support, that's what i'm trying to say for days.
    So again when it comes to install win10, people don't necessarely need to use the script because i've just said recovery options are already present in win10. is it right to say this ?
     
  13. Flipp3r

    Flipp3r MDL Guru

    Feb 11, 2009
    2,021
    970
    90
    No, you don't need to use the script for any install. It just makes life easier. Booting into WinPE & using an install script/batch you can install any Win OS, any edition, any container (wim/esd/swm), any custom mod, unattends, drivers - the list is endless.
    Personally I use 1 usb install key (holds a 256GB M.2 Sata) that boots into WinPE (64bit uefi/legacy 7 32bit legacy) with 1 install script that handles all server/desktop editions. Standard drivers are integrated. Appropriate unattends copied across.
    So much easier these days. Windows for Workgroups on floppy anyone? Corel Draw on floppy? Talk about all day installs!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,428
    11,759
    240
    I would assume so that you couldn't just delete the file or partition and completely ruin a computer.
    It's obviously not foolproof to just have another partition, but it's one more layer of security.
     
  15. mehdibleu

    mehdibleu MDL Expert

    Jun 14, 2017
    1,008
    251
    60
    ok i see but could you please answer the question that i"ve been asking for days without answer until now , lol

    your script is useful when it comes to install win7 or win8 as recovery options are not included for win7 and need disk support for win8.1, in these 2 cases, the script is very useful as it allows you to create recovery partition that allows you to use it later to i.e resetpc successfully for win8.1 or to reinstall widows for win7.

    But for win10, people don't need to use your script to use recovery options as they are included by default in win10 so you can use these recovery options to resetpc at any time without your script and without extra disk support, so do you agree with this ?

    so to sum up :

    win7 and win8.1 => your script is useful for the reason i mentionned above.
    win10 => no need to use your script for the reason i mentionned above.
     
  16. GodHand

    GodHand MDL Addicted

    Jul 15, 2016
    534
    926
    30
    I always remove WinRE from ever image I deploy to my personal devices. Whether I do it using an answer file as shown...

    Code:
       <settings pass="oobeSystem">
            <component name="Microsoft-Windows-WinRE-RecoveryAgent" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <UninstallWindowsRE>true</UninstallWindowsRE>
            </component>
        </settings>
    
    or by removing it from the offline .wim and simply not configuring a recovery partition. Windows Recovery is simply not beneficial whatsoever for me.

    Instead I will usually create a hidden partition on a second physical drive, completely independent from the primary drive Windows is installed on, and add my own custom WinPE boot.wim to it and add it to the boot menu. Other times I will add the boot.wim to a network share location I've created on my server so I can access it from any PC on the network, as well as remotely outside of the network. This way I have absolutely every tool at my disposal, including significantly better system recovery programs than Windows Recovery, as well as absolute gem imaging, capturing and deployment tools like the MTD LiteTouch PE (also free to build).

    I can understand keeping a recovery image or drive that has a factory backup on it for the recovery of OEM devices like Lenovo and Dell, but outside of that, default Windows Recovery is average at best in a mediocre environment. If you do either a lot of imaging, deployments coding and the like, you most definitely go another route with a recovery environment. That's even more critical if your device is security centric with a lot of hardware security...or if you just want to actually be able to repair your device without any problems regardless of the software and/or installation problems that may arise.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. Flipp3r

    Flipp3r MDL Guru

    Feb 11, 2009
    2,021
    970
    90
    @GodHand You could always just mount the WinRE.wim, integrate your lan drivers & copy across your tools.
    You can change your WINPESHL.INI or just use Startnet.cmd. RE is just PE+Recovery component...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    50,324
    106,607
    450
    #198 Enthousiast, Oct 12, 2017
    Last edited: Oct 12, 2017
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. audison

    audison MDL Novice

    Dec 15, 2012
    39
    1
    0
    #199 audison, Apr 1, 2018
    Last edited: Apr 2, 2018
    [​IMG]

    help? did everything as instructed still does not work
    Even without this I can finish and make the iso but when I boot the iso from usb my laptop still shuts down :(
     
  20. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    50,324
    106,607
    450
    Use the correct winrecfg package for the windows edition.

    You really don't need this package for the normal diskpart and apply image part of the script, it's only for when you create a recovery partition.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...