Skip to main content
Topic: [HOWTO] Install Windows after you've installed Linux using dism (Read 722 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[HOWTO] Install Windows after you've installed Linux using dism

Hi guys! :)

DISCLAIMER: This tutorial is meant to help you install Windows when it refuses to be installed the normal way. I'm in no way responsible for any data loss or misuse/misinterpretation of this how-to guide. Whatever you do, you do it at your own risk.


THE PROBLEM:
Windows wants to be the only OS on your computer and therefore it might not allow you to have working Linux/Mac instances already set up on your PC. This is what I've been told by ASRock but I guess the problem persists with other MOBO manufacturers, too.

Whenever I would try to install Windows 10/11 the normal way, I would get the "windows could not prepare the computer to boot into the next phase of installation" error.

One workaround here is to remove all your Linux disks from your motherboard, whether it be NVMEs or SATA disks and proceed with the installation of Windows. But who wants to do that anyway, right? :D

ONE POSSIBLE SOLUTION:
OK guys, so let's break it down into steps:

1. Partition and format your disk
Let's assume the disk you want to install Windows on is /dev/sda. You want a 100MB EFI partition, a 16MB Microsoft Reserved partition and obviously one regular system partition that will utilize the rest of available space.
Code: [Select]
sgdisk -o /dev/sda
sgdisk -n 1::+100MiB -t 1:EF00 /dev/sda
sgdisk -n 2::+16MiB -t 2:0C01 /dev/sda
sgdisk -n 3 -t 3:0700 /dev/sda
sgdisk -p /dev/sda

mkfs.vfat -F32 /dev/sda1
mkfs.ntfs -f /dev/sda3
For more information how to partition disks for Windows UEFI setups, see https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/configure-uefigpt-based-hard-drive-partitions?view=windows-11

2. Boot into the Windows installation flash disk
When greeted with the first window (i.e. the language/keymap dialog), we can straight up enter the expert mode by pressing SHIFT+F10 :D

3. Assign letters to our partitions
Let's use diskpart in the command line now
Code: [Select]
diskpart
list vol # make a note of the letter assigned to our Windows installation flash drive (typically it'll be either ESD-USB or CCCOMA*)
list disk # make a note of the disk you want to install Windows on
select disk 0 # now select the disk
list part # list partitions
select part 1 # our EFI partition
assign letter="B" # "B" as in "boot"
select part 3 # our system partition
assign letter="W" # "W" as in "windows"

4. List Windows version and pick the right one:
Code: [Select]
dism /Get-WimInfo /WimFile:D:\Sources.install.esd
where D: stands for the letter assigned to our installation disk - ESD-USB or CCCOMA. Please also note that installation disks made with the use of Rufus will have install.wim instead of install.esd here (these two pieces of information pertain to steps 4 and 5).

5. Now deploy the Windows image onto our disk
Code: [Select]
dism /Apply-Image /ImageFile:D:\Sources\install.esd /index:1 /ApplyDir:W:\


6. Install Windows EFI files
Code: [Select]
W:\Windows\System32\bcdboot W:\Windows /s B: /f UEFI

DONE!  8)

Keep in mind that after you've deployed Windows using dism, the computer might reboot a few times during the setup so you may have to press F11/F12 to get into the boot menu of your motherboard and select Windows Boot Manager. Do remember that once you've made it to the Windows desktop, you have to activate the system using your genuine Windows serial key. 

Do let me know in the comment section whether you've ever had any problems installing Windows when Linux was already there.

Take care!