Scenario: Your Windows PC\notebook will no longer boot to Windows from it’s internal hard disk\SSD.
Legacy or UEFI?
Windows can be booted it two very different ways: Legacy or UEFI.
To repair a Windows installation you must boot from the ISO or Recovery files in the same way that Windows was booted in.
Many systems can boot in both Legacy mode (sometimes called CSM or BIOS or MBR mode) and UEFI mode.
- If your Windows internal system disk (usually the first disk) is a GPT-partitioned disk then your Windows system must have been booted via UEFI.
- If your Windows internal system disk (usually the first disk) is NOT a GPT disk then your Windows system must have been booted via a Legacy BIOS boot.
You can check the partition type using one of these methods:
- In E2B – Utilities menu, use List BIOS Disks – a partition type of 0xEE shows the drive is has GPT partitions.
- In agFM – F3, the Windows disk will show ‘gpt’ type partitions – e.g. hd1,gpt1.
- In WinPE – DISKPART – LIST DISK, there will be an asterisk in the GPT column of GPT disks.
If your Windows disk is GPT you MUST EUFI-boot to the E2B USB drive (typically the agFM menu system will load).
If your Windows disk is Legacy (not GPT) you MUST Legacy\BIOS\CSM boot to the E2B USB drive (typically the E2B menu system will load).
Fixing the Windows system
Note: NEVER set the first boot device as the E2B USB drive – the BIOS boot menu should be set to boot from your internal Windows system drive. Always boot from the E2B USB drive using the BIOSes Boot Select pop-up menu (using a hotkey such as F8 or F12).
- Use the Microsoft Windows Install ISO
a. Boot to E2B\agFM in the correct way – Legacy or UEFI (see above)
b. Select and boot to the ISO
c. DISCONNECT THE E2B USB DRIVE
d. Choose the Repair option – Startup Repair
If you have booted using E2B from a WinPE ISO, ensure the file has a ’01’ file extension – e.g. WinPE.iso01 or WinPE_.iso01.iso.
This ensures that the first internal hadr disk is recognised as the ‘boot device’ and not the E2B USB drive!
Important note: Always disconnect the E2B USB drive once you have booted to WinPE (which loads into RAM). This prevents the USB drive from accidentally being ‘repaired’.
WinPE commands for a quick fix
Get to the Windows Command prompt and try these commands which operate on the ‘boot drive’.
Note: Ensure you disconnect the E2B USB boot drive first in case it thinks the boot disk was your USB drive and installs Windows boot code/files onto it!
This assumes you have a standard Windows system (do not use if you have a dual-boot Linux/Windows system).
- bootrec /fixmbr (will appear to be successfully even if you Legacy-boot to USB and use on a GPT\UEFI disk)
- bootrec /fixboot (will appear to be successfully even if you Legacy-boot to USB and use on a GPT\UEFI disk)
- bootrec /scanos (will appear to be successfully even if you Legacy-boot to USB and use on a GPT\UEFI disk)
- bootrec /rebuildbcd
You can use Diskpart – List Vol to view the volumes and List Part to view the partitions.
Use SEL VOL or SEL PAR to select a partition. Use ASSIGN LETTER=V to assign it a drive letter if it does not have one.
For legacy booting:
bcdboot C:\Windows /s C:\ (Recreates the system partition files on C: with those copied from C:\Windows (change drive letters as appropriate).
For UEFI booting:
bcdboot C:\Windows /s V: /f UEFI (you must use Diskpart to assign the V drive letter to the 100MB EFI FAT32 Hidden partition)
For both Legacy and UEFI:
bcdboot C:\Windows /s V: /f ALL (where you have used Diskpart to assign the V drive letter to the 100MB EFI FAT32 Hidden partition)
To make a Legacy disk bootable, use:
bootsect /nt60 SYS /mbr (Rewrites boot code to the system partition and updates your master boot record with legacy boot code)
Note: Ensure you disconnect the E2B USB boot drive first in case it thinks the boot disk was your USB drive!
Master Boot Record – The first sector on the whole drive and contains a boot loader as well as information about partitions on the drive.
Volume Boot Record (aka Partition Boot Sector/System Partition in MS terminology) – The first sector on a partition containing information to load an operation system.
Quick fix commands for repairing Windows
You can try to fix any corrupted Windows files using:
sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows
A separate DISM command can scan the Windows component store for corrupt files and automatically repair them:
DISM /Image:D:\ /Cleanup-Image /RestoreHealth