26/10/2014

[Windows 7] Create repair USB key to run bootrec

Say that your Windows 7 machine had a problem and you can no longer boot in; usually this can be easily fixed by running the bootrec utility to repair the MBR/boot sector

For some very important reasons, this extremely useful tool can only be run from a Windows install DVD and you don't have direct access to it, even from the safe mode. Luckily, you can create a bootable USB key where to place the Windows RE without having to get said DVD - only catch: you'll need access to a working Windows 7 PC.

Now that your friend generously gave you permission to use his PC, let's get started.



Insert the USB key (everything on it will be erased for this procedure to work) then create a bootable fat32 USB drive.

Now browse the USB key and create two folders: boot and sources

From a Windows Explorer window (Windows key + E), select Organize->Folder options, switch to the View tab and select "Show hidden files, folders and drives" then uncheck "Hide extensions for known file types" and "Hide protected operating system files (Recommended)"; you'll want to revert the latter back after we're done.

Copy C:\Windows\Boot\PCAT\bootmgr on your USB stick, without putting it in any folder.

Then copy these files under the boot folder:

C:\Windows\Boot\DVD\PCAT\boot.sdi
C:\Windows\Boot\DVD\PCAT\BCD and rename it to bcd (lowercase)
C:\Windows\Boot\DVD\PCAT\my_language\bootfix.bin where my_language is your language eg: en-US, it-IT

Finally, copy C:\Recovery\some_folder\winre.wim under source and rename it to boot.wim

some_folder looks like 8e5e3ae2-ef81-11df-ae92-d07735c275df

Now insert the USB on the PC to recover and boot into it; the procedure varies based on your hardware/BIOS but it comes down to pressing a key during boot (usually Fsomething or Del) to display a list of bootable devices to choose from, or to open the BIOS setup to permanently change the Boot devices order.

When the utility starts and you're prompted, choose to Repair your computer. The commands you'll want to run are:

bootrec /fixmbr

and

bootrec /fixboot

You can now exit the tool and boot your PC normally. Depending on how you booted from the USB, you may need to revert the BIOS changes or simply remove the USB stick to avoid booting into it again.


1 comment:

With great power comes great responsibility