Rebuild BCD when server does not boot

I got a sever that did not boot, it should have booted off the local storage, but it told me "no bootable media found" and then tried to start a PXE boot, which is great, but we do not use PXE boot, so that is a clear sign that there is issue with the boot volume manager.........

First, this command should get stuff back online, this will write the boot files back and once complete the server should then be able to get it boot files and start-up as normal.

c:\windows\system32\bcdboot.exe c:\windows
Easy right, but no, I got this error which means there is something a little more sinister going on here as this says it cannot copy the boot files to the volume.......
Failure when attempting to copy boot files
The error message seems to be caused by one primary reason i.e the system partition is set as inactive. If you are deploying an image into different computers at once, you will have to make sure that the system partition is set as active or else the bcdboot command will prompt you the error message

Marking the Partition as Active

To fix your issue, make sure you have a Windows installation DVD or USB drive. After that, follow the given steps:

  1. Insert the Windows installation DVD or USB drive into your system and boot into it.
  2. Once the Windows installation window appears, click the Repair your computer option.
  3. Afterward, navigate to Troubleshoot > Advanced Options and then finally open up a command prompt.
  4. After the command prompt loads up, type in diskpart to open up the DiskPart utility.
  5. Then, type select disk 0 (assuming you only have one hard disk attached to your system). If you are using multiple disks, select the disk where the Windows files reside.
  6. Type list partition.
  7. Afterward, type select partition X (X being the partition where Windows is installed).
    Using DiskPart to Select the System Partition
  8. To mark the partition as active, simply type active.
  9. Exit the DiskPart utility by typing exit.
  10. Finally, enter the bcdboot command again, for example:
c:\windows\system32\bcdboot.exe c:\windows

That should then fix the issue, if not then the boot files might be damaged or corrupted. In such a case, you will have to rebuild it using the bootrec command. Here’s how to do it:

  1. Access a command prompt using the installation media as shown above.
  2. Type in, cd C:\EFI\Microsoft\Boot (C being the drive where Windows is installed).
  3. Delete the bootsect.exe file by typing ‘del bootsect.exe’.
  4. Then, enter the following commands one-by-one:
Bootrec /fixboot
Bootrec /fixmbr
Bootrec /rebuildbcd

Once done, restart your system.