Using Remote Desktop Connection, connect to the Repair VM.
Verify that the OS partition is active
Note
This mitigation applies only for Generation 1 VMs. Generation 2 VMs (using UEFI) does not use an active partition.
Verify the OS partition that holds the BCD store for the disk is marked as active.
Open an elevated command prompt and open the DISKPART tool.
diskpart
List the disks on the system and look for added disks and proceed to select the new disk. In this example, the new disk is Disk 1.
list disk
sel disk 1
List all of the partitions on the disk and then proceed to select the partition you want to check. Usually System Managed partitions are smaller and around 350 Mb in size. In the image below, this partition is Partition 1.
list partition
sel partition 1
Check the status of the partition. In our example, Partition 1 is not active.
detail partition
If the partition isn't active, set the Active flag and then recheck that the change was done properly.
active
detail partition
Now exit the DISKPART tool.
exit
Fix the missing reference in the BCD store
Open up an elevated CMD and run CHKDSK on the disk.
chkdsk <DRIVE LETTER>: /f
Gather the current boot setup info and document it, take note of the identifier on the active partition.
For Generation 1 VM:
bcdedit /store <drive letter>:\boot\bcd /enum
If this command errors out due to \boot\bcd not being found, then go to the following mitigation.
Write down the identifier of the Windows Boot loader. This identifier is the one with the path \windows\system32\winload.efi.
For Generation 2 VM:
bcdedit /store <Volume Letter of EFI System Partition>:EFI\Microsoft\boot\bcd /enum
If this errors out due to \boot\bcd not being found, then go to the following mitigation.
Write down the identifier of the Windows Boot loader. This is the one with the path \windows\system32\winload.efi.
In case the VHD has a single partition and both the BCD Folder and Windows Folder are in the same volume, and if the above setup didn't work, then try replacing the partition values with boot.
bcdedit /store <Volume Letter of EFI System Partition>:EFI\Microsoft\boot\bcd /set {bootmgr} device partition=<Volume Letter of EFI System Partition>:
bcdedit /store <Volume Letter of EFI System Partition>:EFI\Microsoft\boot\bcd /set {bootmgr} integrityservices enable
bcdedit /store <Volume Letter of EFI System Partition>:EFI\Microsoft\boot\bcd /set {<IDENTIFIER>} device partition=<WINDOWS FOLDER - DRIVE LETTER>:
bcdedit /store <Volume Letter of EFI System Partition>:EFI\Microsoft\boot\bcd /set {<IDENTIFIER>} integrityservices enable
bcdedit /store <Volume Letter of EFI System Partition>:EFI\Microsoft\boot\bcd /set {<IDENTIFIER>} recoveryenabled Off
bcdedit /store <Volume Letter of EFI System Partition>:EFI\Microsoft\boot\bcd /set {<IDENTIFIER>} osdevice partition=<WINDOWS FOLDER - DRIVE LETTER>:
bcdedit /store <Volume Letter of EFI System Partition>:EFI\Microsoft\boot\bcd /set {<IDENTIFIER>} bootstatuspolicy IgnoreAllFailures