Intro
This is an old topic. I a just trying to wrap it up as a record.
Basically, to apply a Windows 11 image to the C: drive using WinPE and DISM, you must first boot from a WinPE media, then format and partition the hard drive, and finally use the dism /Apply-Image command.
Step 1: Boot from WinPE media or Windows Install Media
- Create/Download a bootable WinPE media (like a USB drive) and boot the target computer from it.
- Once booted, the command prompt will appear. You may need to connect to a network to access your image file or copy it to the local drive.
[!TIP]
Alternatively, grab a Windows 11 Installation media (a DVD-ROM or Bootable USB); Boot up the target computer, click "Next" button a few times till reaching "Select setup option", then toggle "Repair my PC" , select "US" as keyboard --> "Troubleshoot" --> "Command Prompt" till landing into a Command Prompt window.
Most likely, the Windows 11 Sources folder is located at D drive (please confirm it with your case).
Step 2: Prepare the C: drive
- 1- wipe the hard drive,
- 2- create new partitions,
- 3- assigning a drive letter (e.g.,
C:) to the partition where Windows will be installed.
Type diskpart in the Command Prompt to prepare the partitions for installation:
# List and select disk
list disk
## Be very careful to select the disk letter you prefer,
## as the next step will erase all data on it.
select disk 0
# Clean the disk
clean
# convert disk from Legacy BIOS scheme to UEFI scheme
convert gpt
# Create EFI partitions
## EFI partition of 500MB (can be bigger or smaller)
create partition efi size=500
## Format EFI partition
format quick fs=fat32 label="system"
## Assign the letter of S for later operations of bcdboot
assign letter=S
## Create Microsoft Reserved partition (msr):
## minimum: 16MB, Disk size <16GB: 32MB, Disk size 16GB+: 128MB
create partition msr size=16
## Create Windows partition
create partition primary
## Format Windows Partition
format quick fs=ntfs label="Windows"
## Assign the letter of C
assign letter=C
# Quit the `diskpart` env
exit
Step 3: Apply the Windows image
- Pre-requisites:
- Use the
dism /Apply-Imagecommand to apply the Windows 11 image to the prepared drive. - Ensure the image file is accessible, for example, on a network share or a separate USB drive, and update the path in the command accordingly.
- Use the
- The command should be structured like this, run from the Command Prompt in WinPE:
- This command assumes your Windows image (
install.wim) is on a drive labeledE:within the WinPE environment and you want to apply it to theC:\drive. - The
/Index:7argument specifies that you are applying the 7th image in the WIM file.
- This command assumes your Windows image (
So we will apply the "Windows 11 Pro N for Workstations" edition, which is index 11:
dism /Apply-Image /ImageFile:E:\install.wim /Index:7 /ApplyDir:C:\
(Optional) take a look at what Windows 11 version we have in the very image file:
dism /Get-ImageInfo /ImageFile:E:\install.wim
## The output be like:
Deployment Image Servicing and Management tool
Version: 10.0.26100.5074
Details for image : I:\sources\install.wim
Index : 1
Name : Windows 11 Home
Description : Windows 11 Home
Size : 22,235,588,527 bytes
Index : 2
Name : Windows 11 Home N
Description : Windows 11 Home N
Size : 21,617,771,836 bytes
Index : 3
Name : Windows 11 Home Single Language
Description : Windows 11 Home Single Language
Size : 22,213,449,980 bytes
Index : 4
Name : Windows 11 Education
Description : Windows 11 Education
Size : 23,183,114,242 bytes
Index : 5
Name : Windows 11 Education N
Description : Windows 11 Education N
Size : 22,545,047,299 bytes
Index : 6
Name : Windows 11 Pro
Description : Windows 11 Pro
Size : 23,205,470,491 bytes
Index : 7
Name : Windows 11 Pro N
Description : Windows 11 Pro N
Size : 22,566,006,362 bytes
Index : 8
Name : Windows 11 Pro Education
Description : Windows 11 Pro Education
Size : 23,183,164,880 bytes
Index : 9
Name : Windows 11 Pro Education N
Description : Windows 11 Pro Education N
Size : 22,545,073,068 bytes
Index : 10
Name : Windows 11 Pro for Workstations
Description : Windows 11 Pro for Workstations
Size : 23,183,215,518 bytes
Index : 11
Name : Windows 11 Pro N for Workstations
Description : Windows 11 Pro N for Workstations
Size : 22,545,098,837 bytes
The operation completed successfully.
Step 4: Configure for booting
Remove the drive letter of S prior to Rebooting.
## Use `diskpart` tool
diskpart
## The next ops in `diskpart` env
list volume
## Select the volume you are going to remove the letter against
select volume 3
## Remove the drive letter
remove letter=S
## Verify the drive letter has been removed
list volume
## Exit the `diskpart` environment
exit
After the image is applied, use bcdboot to create the boot configuration data for the new installation.
## S: is the boot partition, often the EFI partition in UEFI scheme,
## or C: in Legacy BIOS scheme
bcdboot C:\Windows /s S:
## Check out if the Boot record has been created on EFI Partition
dir S:
## There shall be a folder "EFI" on S drive
dir S:\EFI
## There shall be 2 folders
## Microsoft
## Boot
Step 5: Remove the media and Reboot
As such, finish off the installation process.