murphy78 DiskPart and Apply Image Script

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

  1. 0584646546846

    0584646546846 MDL Novice

    Nov 4, 2020
    21
    5
    0
    Hello to you @murphy78 ,

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

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,427
    11,737
    240
    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 Senior Member

    Feb 24, 2011
    398
    99
    10
  4. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,427
    11,737
    240
    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

    Nov 18, 2012
    7,427
    11,737
    240
    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

    Oct 30, 2009
    49,901
    104,491
    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

    Nov 18, 2012
    7,427
    11,737
    240
    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

    Nov 18, 2012
    7,427
    11,737
    240
    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 Guru

    Feb 11, 2009
    2,015
    967
    90
    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/
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,427
    11,737
    240
    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 Guru

    Feb 11, 2009
    2,015
    967
    90
    Yeah I'm the same. Clean install as well. It's so quick and easy these days... (Compared to the floppy days, sheesh!)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. Tiger-1

    Tiger-1 MDL Guru

    Oct 18, 2014
    7,894
    10,735
    240
    @ flipp3r same here is more easy I think...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,427
    11,737
    240
    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

    Nov 18, 2012
    7,427
    11,737
    240
    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

    Oct 18, 2014
    7,894
    10,735
    240
    very good work brother thanks for your contribution once again :worthy:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,276
    929
    60
    Oh yes ! :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,384
    2,037
    210
    That is a nasty host. Offers virus exe before the actual .zip
     
  18. Dear Friend i am Great Fan of your scripts.
    Thanks a lot :)
     
  19. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,427
    11,737
    240
    New Version has been released.
    https://mir.cr/LX9H3Z8C
    File Name: murphy78-DiskPart-Apply-v1.3.0.zip
    Size: 2.41 MB
    SHA1: 18DEC4C16F73A021E8473CF51FDE63E308F6DEA4
    Format: zip/pw
    PW: MDL2021

    Changelog:
    1.3.0 Removed Recovery Partition Support. Option has been deprecated and seems to only have been supported on Win8.x
    Added v1.1 custom script installer compliments @Enthousiast
    Added default winrecfg.exe & winrecfg.exe.mui en-us files
    Removed winrecfg packages and information about package integration
    Added winpeshl.ini option
    Fixed error in bios boot winre copy option syntax that prevented toggling
     
  20. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,276
    929
    60
    Thanks ! I try later with the French language :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...