Windows

How to add Registry keys via DISM in Windows

Featured-Image_new

Using DISM to add Registry entries means modifying the default Windows install image, the install.wim file, which involves servicing an offline image, mounting an image, and committing changes made to the image. The offline image is serviced using DISM (Deployment Image Servicing and Management), a native Windows program. DISM is a command-line program for servicing and preparing Windows images, including those needed for Windows Preinstallation Environment (Windows PE), Windows Recovery Environment (Windows RE), and Windows Setup. Please see: Install Wim: How to Add Packages to Windows image the DISM Tool and Remove Windows 10 Apps with DISM: How to remove pre-provisioned apps from Windows Image.

Changes to the way Windows is installed are also possible with the DISM command options. Drivers may be added or uninstalled, language packs can be used to produce multilingual Windows install media, Windows Updates can be used to keep a fresh Windows installation up to date right away, and so on. Here are other related guides: Install Wim: How to Add Packages to Windows image the DISM ToolRemove Windows 10 Apps with DISM: How to remove pre-provisioned apps from Windows Image, for common DISM errors see: Error 183: The specified image is currently being serviced by another DISM operation, and DISM Error 87: The package is unknown.

In this guide, I will show you how to service or modify the Windows Registry on an offline image. I will be using a Windows 11 ISO image file in this example, but the technique is the same whether you use a Windows 10 ISO image.

Step 1: Mount Offline Image

Extract the ISO image to a folder and name it whatever you want.

image0.1-1

In this example, after extracting, I move it to the root folder on disk C: and name the folder ISO.

image0.5

Alternatively, you can mount a Windows ISO image as a virtual DVD by double clicking on it. Open the mounted ISO in Explorer, select all files and directories, then copy and paste the ISO content into the ISO folder:

image0.4

Note: You do not have to perform the steps above if you have Windows install media on a USB flash drive.

Make a folder to hold the offline image. In this example, I created a folder called Mount in the root folder C:\Mount.

image0.4-1

Open the Windows Start Menu and search for PowerShell, then run as administrator.

image0.5-1

Enter the following command to check what editions are included in the image:

Dism /Get-WimInfo /WimFile:C:\ISO\Sources\install.wim
image0.8

Note the index number of your selected edition. In this example I want to use PRO edition to edit its registry, noting its index number 6.

Mount the image of your preferred Windows edition using its index number, index 6 in this example:

Dism /Mount-Wim /WimFile:C:\ISO\Sources\install.wim /index:6 /MountDir:C:\Mount
image0.9

The mounting image process will take some time to complete. You can check the Mount folder in C: Mount to see the offline image files.

image0.10-1

Please keep in mind that the disk where the Mount folder is situated requires some free space. It is recommended to utilize a machine with a disk that has more than 15 GB of free space.

Step 2: Edit Offline Registry

To edit an offline registry hive, first import it to a temporary hive in your host registry. In this example, I will import the HKLM\Hardware hive from the offline registry to a temporary hive called OFFLINE in the host registry:

reg load HKLM\OFFLINE C:\Mount\Windows\System32\Config\Hardware
image0.11


The command above creates a new hive HKLM\OFFLINE in the host registry and imports the HKLM\HARDWARE hive from the offline image into it. You can import SOFTWARE, DEFAULT, DRIVERS, SAM, or SYSTEM hives. To see the changes, open the Windows Start Menu and search for Registry Editor, then run as administrator on the host computer.

You will notice it now contains a temporary hive HKLM\HARDWARE\OFFLINE:

image0.12

Step 3: Commit (save) changes

When you’re through with registry changes, use the following command to unload the temporary hive:

reg unload HKLM\OFFLINE
image0.13

The reg unload command removes the temporary hive from the host registry.

image0.14

Unmount the offline image and commit (save) changes using the following command:

Dism /Unmount-Image /MountDir:C:\mount /Commit
image0.15

The /Commit switch saves all modifications to the install.wim file. You’re done if you were using a Windows image on an USB drive. You may now install Windows, which includes your modification by default. If you were using an image transferred from an ISO image to an ISO folder, you can now make a new ISO with your preferred utility.

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x