Jump to content











Photo
- - - - -

Creating some sort of bootable recovery image/partition


  • Please log in to reply
12 replies to this topic

#1 Uneitohr

Uneitohr

    Frequent Member

  • Advanced user
  • 219 posts

Posted 10 December 2016 - 01:16 PM

Hello,

 

I am trying to come up with a way to build a recovery partition. I'd like this recovery partition to hold a windows setup wim and to be able to boot from it whenever necessary.

From what I know, and please correct me if I am wrong here -- the best way to repair a windows os is via an upgrade operation or an install over it. So the idea here is to build a recovery partition with the best type of repair for windows os from 7 to 10.

 

I also require this to be fully scriptable -- ie automated.

 

What are your thoughts on this?

Would creating a partition that holds a wim image and added to BCD suffice?

Are there any better ways of accomplishing this?

 

Thank you



#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 10 December 2016 - 02:24 PM

... the idea here is to build a recovery partition with the best type of repair for windows os from 7 to 10.

 

I also require this to be fully scriptable -- ie automated.

 

...and make some coffee also?

In case, two spoons of sugar, black for me. :whistling:

 

 

 

From what I know, and please correct me if I am wrong here -- the best way to repair a windows os is via an upgrade operation or an install over it. 

The first would be an upgrade and the second a in-place re-install, no "repair".

 

The idea (generic) of a recovery partition is:

1) not an upgrade

2) not an install "over" something

3) not a "repair"

 

BUT a recovery, i.e. given a set point in time, by means of the recovery partition you bring the whole system back in time EXACTLY as it was at the given set point, you should think at it more as a "reset to factory".

 

This is anyway how all "recovery" partitions have been implemented till now by - say - the large OEM's on laptops and notebooks, and they are invariably "single OS", i.e. either 7 or 8 or 8.1 or 10, not multi-OS (which BTW represents a considerable complication).

 

The actual techniques in use may vary, from "GHOST" like images to fully scripted automatic installs to sysprepped images, etc.

 

Microsoft provides some guides for the newer OS's on how to create such partitions and use the WinRE (Windows Recovery Environment, which is another name for a WinPE):

https://msdn.microso...rive-partitions

 

The use in this or that way of a WinRE dates back to Vista, however, JFYI:

http://www.msfn.org/...via-f8-startup/

before that each OEM used this (or that) proprietary solution, such as PC Angel, Ghost or similar.

 

:duff:

Wonko



#3 Uneitohr

Uneitohr

    Frequent Member

  • Advanced user
  • 219 posts

Posted 10 December 2016 - 11:01 PM

BUT a recovery, i.e. given a set point in time, by means of the recovery partition you bring the whole system back in time EXACTLY as it was at the given set point, you should think at it more as a "reset to factory".

 

That's exactly what I need. A factory reset.

 

Here's a little insight about what I am trying to do.

I use MDT/WDS from Microsoft for Windows deployment. And upon completion, after application install and configuration, I would add a command to pack the entire C: drive, while running windows into a wim image.

Then I would do the following:

  1. add the BCD a entry for a Winpe WIM.
  2. WinPE launches and asks wether to apply the wim on C drive or exit.
  3. If yes, it will format and apply to C drive.

Bam, insta-factory reset.



#4 agni

agni

    Frequent Member

  • Tutorial Writer
  • 270 posts
  • Location:Bengaluru (Bangalore)
  •  
    India

Posted 11 December 2016 - 05:47 AM

This might be useful, although I haven't tried it myself as I use Lenovo One Key Recovery.

 

https://forums.mydig...h-MEDIA-CREATOR

 

EDIT: I just realised that the site down for some time. So you may not be able to download the files.



#5 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 11 December 2016 - 10:10 AM

http://rmprepusb.blo...tion-using.html

 

You don't say if the system is UEFI or MBR?



#6 Uneitohr

Uneitohr

    Frequent Member

  • Advanced user
  • 219 posts

Posted 11 December 2016 - 11:00 AM

You don't say if the system is UEFI or MBR?

 

It's for MBR.

 

I just realised that the site down for some time. So you may not be able to download the files.

 

They were hacked a few weeeks ago and lots of content was deleted. I'll try that when the author updates the page.



#7 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 11 December 2016 - 11:13 AM

Well the link I posted for Aomei One Key Recovery should do what you want???



#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 13 December 2016 - 01:05 PM

The actual tool page is online alright.
the tool is at version 4.05:

http://www3.anaretho...very_tools.html

 

 

 

OEM / Factory recovery partition creator Version
  • Operating system supported : Windows 7, 8, 8.1 and 10
  • System/Drive support : BIOS (MBR) and UEFI (GPT)
  • Latest version : 4.0.5
  • Support status : Supported
Features (All Windows versions)
  • Create a complete image of the Windows installation
  • Official Microsoft method for system recovery on Windows
  • Make use of built-in Windows 7/8/10 software
  • Translation required for the menu - French, English included
  • Bit-Locker is supported
  • Support for UEFI/GPT
  • Off-line file browsing
  • Source code included for nearly everything
  • Based on CMD scripts with AutoIT gui
  • Works for 32 and 64 bits version of Windows
  • Instructions included
  • Support the creation of a recovery USB drive
  • Support the option to create DVD recovery media (version 3.0.0 and up only)
  • Support non-destructive and destructive recovery

:duff:

Wonko



#9 Dangerous85

Dangerous85

    Newbie

  • Members
  • 24 posts
  • Location:UK
  •  
    United Kingdom

Posted 18 December 2016 - 04:24 PM

Hello,

 

I am trying to come up with a way to build a recovery partition. I'd like this recovery partition to hold a windows setup wim and to be able to boot from it whenever necessary.

From what I know, and please correct me if I am wrong here -- the best way to repair a windows os is via an upgrade operation or an install over it. So the idea here is to build a recovery partition with the best type of repair for windows os from 7 to 10.

 

I also require this to be fully scriptable -- ie automated.

 

What are your thoughts on this?

Would creating a partition that holds a wim image and added to BCD suffice?

Are there any better ways of accomplishing this?

 

Thank you

I have done something close to this using batch files and dism
you have a wim file you use as your "Master"

set up your pc then use the batch file to capture it as a "user set factory image"

if it all goes wrong you just "reset" and it restores you captured image

 

This partition's the hard drive creates a recovery partition then hides it (until needed)

 

If this is what you are looking for ??

 

1)      Boot from usb

2)      Wait for menu to appear

3)      Enter Hidden Option Shift and N – (New Drive)

4)      Confirm drive deletion /creation – three times

5)      Wait for disk to be created and files to be copied

(will appear to pause on backup.wim –wait it’s a large file)

6)      Pc will automatically shutdown -When pc has shutdown remove usb flash drive

7)      Power on wait for menu to appear

8)      Select option 2 and wait for pc to reboot you wim file and set up

9)      Plug in usb flash drive again

10)  Copy  utils folder from usb flash drive to c:\windows\system32

11)  Safely eject usb flash drive

12)  From c:\windows\system32\utils RIGHT CLICK recovery.bat create desktop shortcut

13)  From desktop run recovery shortcut

14)  Wait for reboot – wait for menu select hidden option SHIFT and C ( to create)

15)  Pc will reboot


Edited by Dangerous85, 18 December 2016 - 04:47 PM.


#10 Uneitohr

Uneitohr

    Frequent Member

  • Advanced user
  • 219 posts

Posted 18 December 2016 - 06:10 PM

The actual tool page is online alright.
the tool is at version 4.05:

http://www3.anaretho...very_tools.html

 

:duff:

Wonko

 

Thanks for the link. I tried to product, it's very hard to automate. It's very good for manual setup but it isn't what I am looking for.

 

 

 

I have done something close to this using batch files and dism
you have a wim file you use as your "Master"

set up your pc then use the batch file to capture it as a "user set factory image"

if it all goes wrong you just "reset" and it restores you captured image

 

This partition's the hard drive creates a recovery partition then hides it (until needed)

 

If this is what you are looking for ??

 

Yes, that's what I need. I'm gonna add an entry to boot a WinPE, that will execute a batch that will format and apply an image on drive C.

I'll keep you updated on the progress.

 

Thanks for the idea.



#11 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 19 December 2016 - 10:47 AM

Maybe this will also help?

http://www.rmprepusb...ls/auto_restore



#12 Dangerous85

Dangerous85

    Newbie

  • Members
  • 24 posts
  • Location:UK
  •  
    United Kingdom

Posted 21 December 2016 - 03:14 PM

Thanks for the link. I tried to product, it's very hard to automate. It's very good for manual setup but it isn't what I am looking for.

 

 

 

 

Yes, that's what I need. I'm gonna add an entry to boot a WinPE, that will execute a batch that will format and apply an image on drive C.

I'll keep you updated on the progress.

 

Thanks for the idea.

Windows 7 Recovery Project

 

Purpose

                Usb flash drive with bootable WinPE

                Holds wim image

                Formats full disk and creates 2 partitions – recovery and system

                Restores recovery wim to recovery partition

                Restores system wim to system partition

                Setid on drive – Hidden or Not

                Set system partition to active

                Reboot and setup windows as normal (including user documents?)

 

Stages

Stage 1- Blank Hard drive Restore

Stage 2- Setup user

                                Set up utils folder (containing batch files imagex etc.)

Stage 3- Enter recovery Mode

Stage 4- From Recovery Mode Capture system drive now complete and set up

Stage 5- Switch back to Normal Mode issue to user

Stage 1

Using WinPE restore image this will clean drive create 2 partitions recovery and system

Set system drive to active

Restore windows to system drive

Restore recovery to recovery drive

Reboot

Stage 2

Setup windows as per normal

Copy user document

Apply latest updates

Copy Utils folder from R:\Utils to c:\windows\system32

Thus creating C:\windows\system32\utils

From this folder run Recovery.bat

This will set partition 1 to active, un-hide Recovery partition (currently not hidden) and display a message box with a countdown

Stage 3

Recovery mode

Run Menu.bat

3 options 1 hidden

 1. I have changed my mind get me back to windows 7 Press 1 then enter

2. Restore my drive to the state it was issued to me – WARNING THIS IS A DESTRUCTIVE RESTORE – your file not backed up will be destroyed – Press 2 then press enter

3. Not shown Type Create – This will capture the system drive

(Future option create 3rd partition for data? Thus non-destructive restore)

 

 

Scripts

Disk part script for full install

 

Select disk 0

Clean

Create partition primary size=20480

Select partition 1

Assign letter=R format fs=ntfs label=”Recovery” quick

Create Partition primary

Select Portion 2

Assign Letter=C Format fs=ntfs Label=”System” quick

Select Partition 2

Active

Exit

 

 

 

Disk part Script for System Drive

Select Disk 0

Select Partition 1

SetId=07 Override

Active

Exit

 

Disk part Script To Set Standard Mode

Select Disk 0

Select Partition 1

SetId=17 Override

Select Partition 2

Active

Exit

 

Recovery.bat

Diskpart /s Diskpart script full path

Rem to change active partition (script)

Rem to unhide Recovery Partition (script)

Rem to set recovery partition active(script)

Shutdown –r –c “Switching to Recovery Mode”

 

 

Nrestore.bat

Diskpart /s Diskpart script full path

Rem to change active partition (script)

Rem to hide Recovery Partition (script)

Rem to set system partition active(script)

Wpeutil reboot

 

 

Restore.bat

Start / Wait imagex /apply c:\images\backup.wim 1

Diskpart /s Diskpart script full path

Rem to change active partition (script)

Rem to hide Recovery Partition (script)

Rem to set system partition active(script)

Wpeutil reboot

 

Create.bat

Start / Wait imagex / capture c: r:\images backup.wim

Diskpart /s Diskpart script full path

Rem to change active partition (script)

Rem to hide Recovery Partition (script)

Rem to set system partition active(script)

Wpeutil reboot

 

Menu.bat

@Echo Off

Cls

Color 0a

Title Recovery Menu

Echo Welcome to the Recovery Section

Echo.

Echo You Now Have Two Options

Echo 1. I Have Changed my Mind Get Me Back to Windows 7

Echo Press 1 followed by the enter key

Echo.

Echo 2. I want to Restore My Computer To The State It Was Issued to Me

Echo WARNING THIS IS A DESTRUCTIVE RESTORE – if you have not backed up your files use option 1 first!

Echo Press 2 followed by the enter key

Echo.

Echo.

Echo Enter Your Choice Now?

 

 

 

If 1 call Nrestore.bat

If 2 call Restore.bat

If Create call create.bat

If menu re run menu .bat


Edited by Dangerous85, 21 December 2016 - 03:16 PM.


#13 Dangerous85

Dangerous85

    Newbie

  • Members
  • 24 posts
  • Location:UK
  •  
    United Kingdom

Posted 21 December 2016 - 03:18 PM

Please note the above is my old version using imagex - it has since been update ( but not documented) using Dism






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users