Friday 9 October 2020

Tip: How to repair a Windows 8/10 system that won't boot without needing any another copy of Windows or WinPE

Although it is always better to try to repair a Windows OS by booting from the original Windows ISO, it is not always present on your E2B USB drive!

This tip works for most Windows 8 or Windows 10 systems. It allows you to repair the OS without needing to have any ISO or WinPE type payload file on the E2B drive and it will always use the correct matching version of WinRE to repair or access the original OS installation - even if you don't actually know what OS version was installed.

It relies on the fact that most Windows 8/10 systems will already contain a \Recovery folder on the internal hard disk containing a winre.wim file. It could be contained within a separate Recovery partition or it could be in the main NTFS boot partition.

This method allows you to boot to the Recovery console and from there you can use the various repair/troubleshooting repair features or drop to the command shell and type in your own commands.

Since E2B\agFM\Ventoy can boot from .wim files, we can directly boot from the winre.wim file like this...

Preparation

Before you start, you will need to copy the file
\_ISO\docs\Sample mnu files\Windows\Boot_Recovery_WIM.mnu 
to the \_ISO\MAINMENU folder. 

This is not needed if you already have agFM installed however, because you can MBR-boot to agFM instead.

Step 1 - GPT or MBR boot?

You first need to know if the hard disk that you are trying to repair is being booted to Windows in MBR-mode or UEFI-mode. Fortunately, for Windows systems, this is easily determined by examining the type of partitions that are on the internal hard disk.

If the system MBR-boots to your E2B USB drive, then use the Utilities - List BIOS Disks menu to view the partition types on hdd1 (the first internal hard disk):




















If the partition type is 0xEE, then the first internal hard disk has GPT partitions and so you know that you need to UEFI-boot in order to repair it. Also, the BIOS must be set to UEFI-boot from the internal hard disk.

If you have the latest E2B beta v2.06, a quicker way to check for a GPT partition would be to type Ctrl+I from the Main menu to load the Windows Install sub-menu and see if HDD1 is flagged as 'GPT':




















If the system UEFI-boots to the agFM menu system, you can easily check the partition types by pressing F3:


Step 2 - MBR or UEFI-boot

If the internal hard disk contains GPT partitions you should UEFI-boot to agFM and use the agFM File Manager to find a \Recovery folder on the internal hard disk. 
On my Windows 8 system, I found a \Recovery\WindowsRE folder:





If the internal hard disk contains MBR partitions, then you will need to MBR-boot to E2B and run the 'Boot to Windows Recovery' menu option:



This menu will list any winre.wim files on any MBR partition (if there are multiple partitions containing winre.wim files, it will list all of them - e.g. dual-boot systems).

An alternative to using the .mnu file, would be to boot to the agFM menu system from the MBR E2B menu.

Step 3 - Repair

Once you boot to the winre.wim file, you can start to examine and repair the OS on the internal hard disk knowing that you will be using the correct Windows repair version.


Note: Although it is possible to MBR-boot to WinRE and repair a UEFI\GPT OS using command console commands, the Windows troubleshooting routines usually get confused and can refuse or fail to repair the boot files. So it is always safest to boot in the correct mode.

From here you can use the automated Windows Troubleshooter to try to repair the OS, or you can use the command console. My favourite commands are:
  • chkdsk /r (you should always check the filesystem first!)
  • bootrec
  • bcdboot
  • bcdedit
  • bootsect
  • sfc (e.g. sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows)
Some instructions can be found here. You can also look for help using Google or YouTube.

If the system starts to boot, but then crashes, it is likely that the files are damaged (especially if chkdsk returned errors!) - you can often restore the original files using DISM and an install ISO - see here.

Do you have other favourite commands or repair methods? If so, please leave a comment below.


Beware Windows Update cycles!
P.S. If you want to try this out on a functioning bootable Windows system, please ensure that all Windows Updates have fully completed first. I have found out the hard way that interrupting a Windows Update cycle by booting to WinPE/WinRE can break Windows! To avoid this, always restart Windows and log in several times to ensure all Windows Updates have been applied correctly first before you boot from a USB drive.

No comments:

Post a Comment