Your cart is currently empty!
How to add Registry keys via DISM in Windows
If you’re building or customizing Windows images, DISM (Deployment Image Servicing and Management) is your go-to tool. It’s powerful, scriptable, and lets you inject drivers, updates, features—and yes, even registry tweaks—into offline Windows images.
This post walks you through how to add registry keys to a Windows image using DISM. It’s cleaner than trying to run post-install scripts and ensures your customizations are baked in from the start.
What You’ll Need
- A Windows image (WIM or ESD format)
- Admin privileges
- Basic knowledge of command line
- A
reg
file with your desired registry keys
Step 1: Mount the Windows Image
First, make a working directory and mount the image.
mkdir C:\Mount
dism /Mount-WIM /WimFile:"C:\Path\to\install.wim" /Index:1 /MountDir:C:\Mount
Tip: Replace the
Index
with the image index you actually want (rundism /Get-WimInfo
if you’re not sure).
Step 2: Create a Registry File
Prepare a .reg
file that contains the registry changes you want to make. Example:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany\Settings]
"ConfigValue"="Enabled"
Save it as custom.reg
.
Step 3: Load the Offline Registry Hive
You can’t just import a .reg
file into the mounted image directly. You need to load the offline registry hive first.
reg load HKLM\OfflineSystem C:\Mount\Windows\System32\Config\SOFTWARE
Now the SOFTWARE
hive from your mounted image is accessible under HKLM\OfflineSystem
.
Step 4: Import Your Registry File
Modify your .reg
file so it targets HKLM\OfflineSystem
instead of HKLM\SOFTWARE
.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\OfflineSystem\MyCompany\Settings]
"ConfigValue"="Enabled"
Then run:
reg import custom.reg
Step 5: Unload the Hive
When you’re done, don’t forget to unload the hive:
reg unload HKLM\OfflineSystem
Step 6: Commit and Unmount the Image
Finalize your changes:
dism /Unmount-WIM /MountDir:C:\Mount /Commit
This writes your changes back into the image.
Wrapping Up
That’s it. You’ve just added a registry key to a Windows image using DISM. This approach is great for automation, enterprise deployment, or custom builds that need pre-configured settings.
Have any registry tweaks you always include in your builds? Drop them in the comments.