Jump to content

Recovery Partition with WinPE 3.0 x86


Tripredacus

Recommended Posts

This is a new project using WinPE v3.0 x86 to make a custom recovery partition along similar lines to this:

That project ended up failing because XP support in the OEM Channel was finished. In this case, SoftThinks does not work on the target motherboard (nor on the new Wind models) and XPe is still supported in the channel.

NOTE: As with previous topics, I am using the OPK Tools not WAIK. If you use WAIK the paths will be different for adding packages!

The system we are going to be making this for is a 2 partition Windows XP Embedded (XPe) that is using the EWF bootloader and RAM Overlay on the Boot partition. The partition order I have planned will be as such:

0 0 WINRE 10240MB NTFS HIDDEN

0 1 BOOT 10240MB NTFS

0 2 STORAGE (remaining space) NTFS

The previous attempt to use this for a WinRE replacement failed and was not solved. Hopefully I will not have these problems this time. This thread is to document my entire process. Here are the steps as I complete them:

1. Find all source files from previous project and arrange them into a new folder. The files are as follows...

x:\windows\system32\fscommand\admin.exe (wrapper to open command prompt)
x:\windows\system32\fscommand\restart.exe (program to restart the computer)
x:\windows\system32\resources\custom.png (branding image)
x:\windows\system32\resources\imagex.gif (animated gif to appear when recovering)
x:\windows\system32\resources\setres.exe (sets screen resolution at boot)
x:\windows\system32\resources\welcome.png
x:\windows\system32\resources\winpe1024x768.jpg (image background of HTA)
x:\windows\system32\full.hta (runs the full recovery)
x:\windows\system32\full_diskpart.txt (for full recovery)
x:\windows\system32\MBR.EXE (to hide drives, set F key for boot)
x:\windows\system32\recovery1024x768.hta
x:\windows\system32\repair.exe (runs a repair recovery)
x:\windows\system32\setres.bat
x:\windows\system32\winpe.bmp
x:\windows\system32\winpeshl.ini

2. Rebrand winpe1024x768.jpg from original PNG file.

3. change various infos in the HTA files, specifically the name of the WIM. I will not document these changes now because I may end up changing them later.

4. Develop a ballpark Deployment workflow:

[diskpart]
sel vol c
assign letter=j
sel vol d
assign letter=k
sel disk 0
clean
create part pri size=10240
assign letter=r
format fs=ntfs quick label=WinRE
create part pri size=10240
sel part 2
active
assign letter=c
format fs=ntfs quick label=Boot
create part pri
sel part 3
format fs=ntfs quick label=Storage
assign letter=d
[/diskpart]

imagex /apply z:\folder\winre.wim 1 r: (the recovery partition)
imagex /apply z:\folder\image.wim 1 c: (the OS partition)

[diskpart]
sel disk 0
sel vol r
att vol set nodefaultdriveletter
[/diskpart]

mbr 0 /install selm 5 11 "Press F11 for Recovery" 0x7 0x17
mbr 0 0 /h

5. Capture the OS to the WDS Server.

6. Create the WinPE for the recovery partition:

copype.cmd x86 c:\winpe_x86\S_RE
xcopy c:\winpe_x86\S_RE\winpe.wim c:\winpe_x86\S_RE\ISO\sources\boot.wim
Dism /Mount-Wim /WinFile:c:\winpe_x86\S_RE\ISO\sources\boot.wim /index:1 /MountDir:c:\winpe_x86\mount
Dism /image:c:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows OPK\tools\PETools\x86\WinPE_FPs\winpe-hta.cab"
Dism /image:c:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows OPK\tools\PETools\x86\WinPE_FPs\winpe-mdac.cab"
Dism /image:c:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows OPK\tools\PETools\x86\WinPE_FPs\winpe-scripting.cab"
Dism /image:c:winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows OPK\tools\PETools\x86\WinPE_FPs\winpe-wmi.cab"
** copy source files to mount\windows\system32
** copy imagex from the Tools folder to system32
Dism /unmount-Wim /MountDir:c:\winpe_x86\mount /commit

** these files are the ones listed above. I will be doing this manually.

7. Test standard redeployment of the OS image (from step 5) onto a machine PASSED

8. Take the entire S_RE folder, copy MBR.EXE into the root. Copy the image.wim into the root, then:

Imagex /capture c:\winpe_x86\S_RE c:\winpe_x86\winre.wim "WinRE" /compress fast

9. Test deployment from a 32bit WinPE, as the MBR.EXE is a 32bit app.

*** more steps to follow/correct ***

Link to comment
Share on other sites


Opening up the topic now, as I have encountered a problem during deployment. They were:

- started deploying from 64bit WinPE, durr MBR.EXE is 32bit app!

- started deploy from x86 WinPE but didn't have NIC drivers installed

- now the wrong partitions get hidden. Using the following:

MBR.EXE 0 0 /h

Hides the BOOT partition instead of the WINRE partition. I need to research the MBR.EXE commands to figure out why it did this. Also the second diskpart script above in deployment is tentatively on hold as it removes the drive letters for all the volumes, instead of R. The recovery partition works, with the only problem being that JPG I am using is the wrong size... OR setres isn't working...

:ph34r:

Update1: The problems with the XPe image not booting after deployment was caused by the XPe install itself. It was created with the idea the C drive was the first partition. It would not boot because the BOOT.INI was pointing to the wrong partition. Also the RAM Overlay is protecting the wrong partition as well. Going to remake the entire XPe install and start over. Also going to use GPO to remove the ability to delete the recovery partition from Windows.

I am likely going to take out the 'nodefaultdriveletter' option as it does not seem to make any sort of difference.

Link to comment
Share on other sites

  • 2 weeks later...

Diskpart is changed in WinPE 3.0, which caused the problem above. After each command you run with Diskpart, it does a drive rescan, so it is a little smarter than in WinPE 2.x. What this means is that since I hide the C drive with the winpeshl.ini, the PE cannot find the backup.wim to restore from. I have fixed this of course! Here is the full recovery code now:

	ObjShell.run "cmd /c mbr 0 0 /uh",0,True
ObjShell.run "cmd /c diskpart /s x:\windows\system32\full_diskpart.txt",0,True
ObjShell.run "cmd /c imagex /apply c:\backup.wim 1 d:",0,True
ObjShell.run "cmd /c c:\mbr 0 0 /h",0,True

So basically I need to unhide the recovery partition before and after applying the image back to the OS drive. This is an important step, that the winpeshl.ini hides the recovery partition when the PE loads, and that it unhides and rehides as needed. Here is the winpeshl.ini before further discussion:

[LaunchApps]
%SYSTEMDRIVE%\Windows\System32\mbr.exe, "0 /reset"
%SYSTEMDRIVE%\Windows\System32\mbr.exe, "0 0 /h"
%SYSTEMDRIVE%\Windows\System32\wpeinit.exe
%SYSTEMDRIVE%\Windows\System32\setres.exe, "1024 768 32 1"
%SYSTEMDRIVE%\Windows\System32\mshta.exe, "%SYSTEMDRIVE%\Windows\System32\recovery1024x768.hta"

So line 2 rehides the partition. Line 1 resets the MBR back to the normal state, ie the recovery partition will not be the Active partition on reboot. I have to hide the partition so much because I need to make sure that the end-user can safely reboot into Windows without a problem. This is NOT a perfect system and there is not much I can do about that. Here is a list of situations where you can not be able to boot into the OS again:

1. You press F11 to boot into the Recovery, but hit reset or power off the machine before WinPE starts to load. In this situation, you SHOULD still be able to get back into Recovery by pressing F11, but if you do not press a key, it will go to the next device, which may be Network Boot or it will just give the generic, unable to boot message.

2. If there is a memory error, as such that WinPE does not function properly, there is no garauntee what the Recovery partition will do on bad memory.

3. If you take memory out of the machine. WinPE 3.0 x86 requires 512MB minimum, but 1GB recommended. If, say, memory goes bad and there is less than 512MB in the machine, booting into Recovery may be impossible, even if you can boot into XP.

Here is another thread concerning this project, where a simple discussion turned into a war of coders:

:angel

Link to comment
Share on other sites

Here is another thread concerning this project, where a simple discussion turned into a war of coders:

An Error Occurred

Sorry, an error occurred. If you are unsure on how to use a feature, or don't know why you got this error message, try looking through the help files for more information.

[#10344] You do not have permission to view this topic.

:unsure:

jaclaz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...