Manually Installing Windows

Covers how to install Windows through the use of CLI.

This is for advanced users. DISM installing is entirely unnecessary for the average computer user.

If you need or want more control over how Windows is installed you can do so with DISM. There are some use cases for this is. Examples include:

  • You have multiple disks in a computer where there is more than one EFI partition present. It appears the Windows installer will sometimes get confused during the install process. It will either write to an EFI partition not on the destination disk or flat out refuse to install.

  • You have prepared a system image you want to use that contains a pre-configured Windows install with software you have installed (sysprep).

Preparing the Disk

You'll of course need a Windows Install USB to boot from. Boot from it and press SHIFT + F10 to open Command and enter the command line steps below in code format.

  1. diskpart

  2. list volume - Note the mount letter assigned to the USB device. You'll need this later to replace example letter X.

  3. list disk - We need to show all disks and their numbers.

  4. select disk # - Replace # with the target disk you want to use.

  5. detail disk - Ensure you have the correct disk. You can verify by checking the name, size and type of disk it is.

  6. clean - This wipes the entire disk.

  7. convert gpt - This is required for proper installation on modern hardware.

  8. create part EFI size=200 - This is EFI boot.

  9. format fs=fat32 label="EFI" - Formats EFI.

  10. assign letter=Y - Assign EFI to Y.

  11. create part MSR size=16 - This is for system use. DO NOT FORMAT!

  12. create part pri size=1024 - This is the Recovery Tools (WinRE).

  13. format fs=ntfs quick label="Recovery" - Formats Recovery.

  14. assign letter=R - Assign Recovery to R.

  15. create part pri - Creates the primary partition for Windows.

  16. format fs=ntfs quick label="Windows" - Format Windows.

  17. assign letter=W - Assign partition to W.

  18. exit

For simplicity, you can create any additional partitions you may need after Windows is installed with Disk Manager.

Getting Image Info

Replace X in the example with the letter assigned to your USB device. You need to find the index you want. This determines if you install Home, Pro, etc. and their N or KN variants:

> dism /Get-WimInfo /WimFile:X:\Sources\install[.wim|.esd]

Look over the results displayed to find the number pertaining to the edition you want. Here is an example of what Media Creation Tool gives you.

Index : 1
Name : Windows 10 Home
Description : Windows 10 Home
Size : 14,513,453,277 bytes
Index : 2
Name : Windows 10 Home N
Description : Windows 10 Home N
Size : 13,698,165,844 bytes
Index : 3
Name : Windows 10 Home Single Language
Description : Windows 10 Home Single Language
Size : 14,495,067,516 bytes
Index : 4
Name : Windows 10 Education
Description : Windows 10 Education
Size : 14,780,689,298 bytes
Index : 5
Name : Windows 10 Education N
Description : Windows 10 Education N
Size : 13,967,235,459 bytes
Index : 6
Name : Windows 10 Pro
Description : Windows 10 Pro
Size : 14,782,181,615 bytes
Index : 7
Name : Windows 10 Pro N
Description : Windows 10 Pro N
Size : 13,968,715,159 bytes

Apply the Image

> dism /Apply-Image /ImageFile:X:\Sources\install[.wim|.esd] /index:[1|2|3|4|5|6] /ApplyDir:C:\

A complete example to install Home would be:

> dism /Apply-Image /ImageFile:H:\Sources\install.esd /index:1 /ApplyDir:W:\

After the image is applied, you need to create EFI boot files:

> bcdboot W:\Windows /s Y: /f UEFI

Create the WinRE folder structure:

> md R:\Recovery\WindowsRE

Copy the recovery tools:

> xcopy /h W:\Windows\System32\Recovery\Winre.wim R:\Recovery\WindowsRE\

Link recovery tools:

> W:\Windows\System32\Reagentc /Setreimage /Path R:\Recovery\WindowsRE /Target W:\Windows

Reboot by exiting the installer. System will reboot into Windows installation and complete the process. If you want to change the user folder path, do not complete the install. Read here. Once setup, you can navigate to C:\Windows\System32\Recovery and delete the file Winre.wim. You already have a copy on the recovery partition.