Cannot reboot after applying WIM file

I've built a developer image and am deploying it to workstations. It's a sysprepped image but I'm facing one issue at the end that I'm hoping someone can help me resolve which is where the machine is not bootable.

Because this is for a relatively small subset of people in the organisation (developers) I'm not using WDS or some other similar deployment mechanism, just a bootable USB key and Windows PE.

My commands are:

diskpart
sel disk 0
clean
cre par pri 500
format quick fs=ntfs
active
cre par pri
active
assign letter=c
exit
dism /apply-image /imagefile:{foo.wim} /index:1 /applydir:c:\

(where {foo.wim} is the name of my WIM file)

The WIM file gets applied, and upon reboot the machine isn't able to boot. Fortunately it's easily solved by booting from an install disk and choosing to Repair. After this all's fine.

Screenshot at initial post WIM apply stage

I'd like however, not to have to do this last step so if someone could point out the step I'm missing I'd appreciate it.

I've added @Elliot Labs suggestion but that still isn't doing it, unfortunately

bootsect /nt60 C: /mbr

You are far better off using MDT to build your deployment. It looks like none of your steps create boot partitions.


There other posible way, and it seems simply:

  1. Create USB boot key with Windows installer (copy disk image content to prepared flash drive)
  2. Remove from it sources\install.wim file
  3. Rename your WIM image to install.wim and place to sources\ folder on your USB key
  4. (Can be omitted) Prepare autounattend.xml file to your taste and place in root of your USB key (Windows SIM can help you)
  5. Boot from you USB key and installer will deploy your image!

Note! You WIM image must contains partition with Windows system installed. Windows system MUST be syspreped before WIM capturing (otherwise installed system will have guaranteed issues)


Complete rebuild of boot files

bcdboot X:\windows /s Y: /f ALL

The above command "installs" the BCD bootloader to the location of your choice. This should correct any BCD corruption by generating a new set of files.

Where X: is the drive to the active Windows folder (PE's windows directory) and Y: is the letter of the drive that is the target drive for the new BCD files. Usually the destination contains the deployed windows installation or is the system reserved partition, if you use such a beast.

/f ALL specifies that it should deploy both a UEFI and BIOS for maximum compatibility. Use /f BIOS or /f UEFI for a more minimal install.

/s Y: Specifies the destination drive for the bootloader deployment.

X:\Windows Specifies the windows directory that should be used as the source for the new boot files. This command does not generate new files by itself.

For more information use bcdboot /?


Boot sector:

You can deploy a boot sector to use a bootloader such as bootmgr (BCD) by using the following command:

You can do that by executing bootsect /nt60 X: /mbr

Where X is the mounted drive letter. Use /nt52 for Windows XP and the sorts. Use bootsect /? for more info


Extra info:

WIM files are file based (higher level) storage mediums and do not copy the sectors of a HDD/SSD. So you cannot copy the file system's boot code with the WIm format since boot code is more of a sector based thing (lower level).

If you did want to copy the boot code too then you might want to go with the VHD(x) format as that emulates an entire HDD and therefore the sectors which contain the bootcode can also be copied or deployed.


Tl;Dr:

Your BCD database is corrupt. Rebuild it.

For good measure, reconfigure your boot sector too.