murphy78 DiskPart and Apply Image Script

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

  1. 0584646546846

    0584646546846 MDL Novice

    Joined:
    Nov 4, 2020
    Messages:
    21
    Likes Received:
    5
    Trophy Points:
    0
    Hello to you @murphy78 ,

    what version of the script for Windows 7 please have to have?
     
  2. murphy78

    murphy78 MDL DISM Enthusiast

    Joined:
    Nov 18, 2012
    Messages:
    6,943
    Likes Received:
    10,703
    Trophy Points:
    210
    Windows 7 doesn't use recovery partitions. You can use the latest diskpart script just fine, but it won't install a recovery partition.
     
  3. vigipirate

    vigipirate MDL Member

    Joined:
    Feb 24, 2011
    Messages:
    215
    Likes Received:
    53
    Trophy Points:
    10
  4. murphy78

    murphy78 MDL DISM Enthusiast

    Joined:
    Nov 18, 2012
    Messages:
    6,943
    Likes Received:
    10,703
    Trophy Points:
    210
    Been years, but winre.wim is a file that is used by Windows to recover the system in a boot environment.
    Winrecfg sets the operating system to treat the winre.wim as the valid recovery environment file.
    IIRC reagentc is the online version and winrecfg is the boot version.
    I don't remember which builds of Windows use a full recovery image, but I think winrecfg sets that as well.
    To include a newer version, you just need to get the ADK and download the dism tools and find the winrecfg and en-us support package.

    People have my permission to tinker with this and update it if you like. I've never made a single cent from this hobby so I don't care about rights issues.
     
  5. murphy78

    murphy78 MDL DISM Enthusiast

    Joined:
    Nov 18, 2012
    Messages:
    6,943
    Likes Received:
    10,703
    Trophy Points:
    210
    Resetbase is a different process. I take it you mean to reset the installation to a default version. I think the renew feature started in either 8.1 or 10.
    In 8.0, there was a system function to re-install the OS using a recovery partition. Before 8 I don't think there is an option to fix the OS without completely re-installing.
    There was system restore points and a backup feature in win7 but I honestly never used them. I don't know how well they would solve the problem.
     
  6. Enthousiast

    Enthousiast MDL Tester

    Joined:
    Oct 30, 2009
    Messages:
    35,561
    Likes Received:
    59,620
    Trophy Points:
    450
    #226 Enthousiast, Mar 2, 2021
    Last edited: Mar 2, 2021
    Dear mehdi, afaik reset pc rebuilds a vhd to clean install the OS, using a recovery partition should re-cover the captured OS as setup by you.
     
  7. murphy78

    murphy78 MDL DISM Enthusiast

    Joined:
    Nov 18, 2012
    Messages:
    6,943
    Likes Received:
    10,703
    Trophy Points:
    210
    It's a bit of a misunderstanding. Resetbase is a dism process that cleans up the winsxs folder of superseded updates and unnecessary files and features. It doesn't fix your registry or remove any malware in any way.
     
  8. murphy78

    murphy78 MDL DISM Enthusiast

    Joined:
    Nov 18, 2012
    Messages:
    6,943
    Likes Received:
    10,703
    Trophy Points:
    210
    It's been years since I've tested it, but I seem to remember using the recovery winre environment to initialize the reset on a win8 install.
    I spent a lot of time figuring out how to properly create the partitions and give them the special guid flags and such, but I honestly haven't used them much.
    If you're bored, you can load up a vm and test it out yourself. To boot into the recovery environment, you just open admin cmd prompt and run "reagentc.exe /boottore"
    There is a proper recovery method, but it can be a pain in the ass to trigger unless you are in legacy boot mode and press f8 before Windows loads
     
  9. Flipp3r

    Flipp3r MDL Expert

    Joined:
    Feb 11, 2009
    Messages:
    1,743
    Likes Received:
    772
    Trophy Points:
    60
    Do you mean a recovery image? It's no longer required. That is why you can no longer use reagentc to set image location. Microsoft expects us to use the PC Reset feature.
    If you create a provisioning package then your apps are also installed during the reset. Notebook manufacturers still often have there own recovery setup. Restoring from an image is fast. PC Reset is not always reliable either.

    If you want a recovery image, check out "OEM Recovery Partition Creator for Windows":
    https://forums.mydigitallife.net/threads/oem-recovery-partition-creator-for-windows.21978/
     
  10. murphy78

    murphy78 MDL DISM Enthusiast

    Joined:
    Nov 18, 2012
    Messages:
    6,943
    Likes Received:
    10,703
    Trophy Points:
    210
    Yeah this is what I've been trying to convey over the last few days, unsuccessfully. The recovery partition is only useful for certain builds that use them.
    It's about what the OS considers the appropriate way to fix itself. It was a big deal when win8 first came out, but with 8.1 and up, they seem to have replaced it with the renew feature.
    I honestly don't consider it a good practice to rely upon a recovery partition, but then I don't care much for the renew option either.
    I always re-install windows when it becomes borked.
     
  11. Flipp3r

    Flipp3r MDL Expert

    Joined:
    Feb 11, 2009
    Messages:
    1,743
    Likes Received:
    772
    Trophy Points:
    60
    Yeah I'm the same. Clean install as well. It's so quick and easy these days... (Compared to the floppy days, sheesh!)
     
  12. Tiger-1

    Tiger-1 MDL Guru

    Joined:
    Oct 18, 2014
    Messages:
    6,203
    Likes Received:
    7,532
    Trophy Points:
    210
    @ flipp3r same here is more easy I think...
     
  13. murphy78

    murphy78 MDL DISM Enthusiast

    Joined:
    Nov 18, 2012
    Messages:
    6,943
    Likes Received:
    10,703
    Trophy Points:
    210
    Can't speak for flipper but my own thoughts on this are that he is talking about an appx provisioned package.
    Every time you install Windows, after the OOBE customer portion and the setupcomplete script, it installs the windows appx packages that it finds in the %ProgramFiles%\WindowsApps folder.
    There might be an easy way to create silent installers and stuffing them in this folder for auto-installs, but I have never done them or heard of them.
     
  14. murphy78

    murphy78 MDL DISM Enthusiast

    Joined:
    Nov 18, 2012
    Messages:
    6,943
    Likes Received:
    10,703
    Trophy Points:
    210
    I'm working on this script again. I think I may remove the recovery capture partition function altogether. It seems to only work with windows 8 and making it right after installing seems fairly pointless as if you have the install media you can just install again.
    I'm also considering reworking the winre partition to autodetect the size of winre.wim and add 20mb wiggle room instead of just using a solid 500mb chunk. Also as I've communicated in the Win11 leak to @Enthousiast, I am going to try to play with different languages and see if I can determine if this script is at least functional on a non-en-us operating system without completely re-writing it. I'll admit I have no idea how on earth I could ever test that. I only have an en-us keyboard. I can load the thing up in a brand new vm to fresh install so there's no residual data in the bios about language, but there's no way for me to actually imitate keystrokes of a non-english keyboard.

    I imagine people do like the alt+0123 thing or something, but I'm not sure I have a way of doing it myself. I am also not sure it works with the choice function. I may have to rework it to use another function that allows for alternate input methods with multiple keystrokes. Also I will include a basic winrecfg and winrecfg.exe.mui of en-us. I'll test the functionality after win11 fully releases, but so far even old files from 2015 work on the 2015ltsb and the win11 leak. I suspect that all this program does is set a few registry keys and make a few GUID identifiers for anti-tamper protection and then set the file permissions so people don't mess with it. I don't think it's a program that changes in functionality over the years, at least hasn't since the win8 days when they made the capture partition.

    Anyway, I come bearing gifts.. I made a slightly more generic version of @Enthousiast 's v1 diskpart/apply image script installer but with the appraiserres.dll copy functionality and the winrecfg.exe and winrecfg.exe.mui files for both the x86 and x64 versions.
    Right now it still has the same file structure for the v1.2.8 instead of a custom path variable.

    Here you go:
    File: Diskpart_Apply_Image_Tool_murphy_custom_v1.zip
    sha-1: 666FF32576E351BD32B54B1AD83512B6555C667E
    size: 2.43mb
    Link: https://userscloud.com/96jmkhp8393s
    Password: MDL2021
     
  15. Tiger-1

    Tiger-1 MDL Guru

    Joined:
    Oct 18, 2014
    Messages:
    6,203
    Likes Received:
    7,532
    Trophy Points:
    210
    very good work brother thanks for your contribution once again :worthy:
     
  16. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Joined:
    Apr 28, 2014
    Messages:
    1,046
    Likes Received:
    713
    Trophy Points:
    60
  17. sebus

    sebus MDL Guru

    Joined:
    Jul 23, 2008
    Messages:
    6,201
    Likes Received:
    1,945
    Trophy Points:
    210
    That is a nasty host. Offers virus exe before the actual .zip
     
  18. mdl052020

    mdl052020 MDL Member

    Joined:
    May 31, 2020
    Messages:
    1,045
    Likes Received:
    1,140
    Trophy Points:
    60
    Dear Friend i am Great Fan of your scripts.
    Thanks a lot :)