Windows Server 2012 booting in recovery (GPT/UEFI FIX)

If OS keeps booting in recovery, this is how you can fix it:

Screen-Shot-2017-07-09-at-9.08.26-AM.png

Open the CMD in the windows live cd and start diskpart and list the disks that are available:

diskpart
list disk

Select the disk for the OS

sel disk 0

List the volumes inside that disk:

list vol

Select the partition in FAT as it is you EFI boot partition

sel vol 4

Assign a letter to the EFI partition so you can mount it

assign letter=G:

Exit diskpart

exit

cd in the EFI boot

cd /d G:\EFI\Microsoft\Boot\

run a bootrec

bootrec /FixBoot

rename the BCD inside the path G:\EFI\Microsoft\Boot\

ren BCD BCD.old

Recreate the BCD file using bcdboot

bcdboot c:\Windows /l en-us /s G: /f All

 You can also run a SFC scan as it might fix some errors

sfc /scannow /offbootdir=g:\ /offwindir=c:\windows

 Then exit reboot and check if the OS can boot 

A common error after reboot could be a system file is corrupted such as the error below:

Windows-7-registry-corrupt.png

To fix it boot back in the live CD and open a CMD and rename the system file as old:

cd /d C:\Windows\System32\config\
ren system system.old

The RegBack contains a working version of the system file so just copy it over.

copy C:\Windows\System32\config\RegBack\system C:\Windows\System32\config\

Then exit reboot and check if everything is working :)