Edit the registry on a mounted WIM

This is an incredibly valuable task.  Windows Vista employs "Image Based Setup", meaning their is no more i386 folder.  Instead, Windows now comes on the DVD as an image that is copied and expanded during setup.  An admin can capture a custom .WIM windows image and mount the WIM to add/modify/remove files.  Did you know you can also edit the registry?

Mount the WIM file to a local folder using ImageX.

C:\ImageX>imagex /mountrw install.wim 1 c:\mount

ImageX Tool for Windows
Copyright (C) Microsoft Corp. 1981-2005. All rights reserved.

Mounting (RW): [C:\ImageX\install.wim, 1] ->
[c:\mount]

Successfully mounted image (RW).

Load the registry hive you need.  In this case let's mount HKLM\Software.

C:\mount>reg load HKLM\test c:\mount\windows\system32\config\software

The operation completed successfully.

Open Regedit to make changes or use Reg Add from the command line.

RegEdit with software hive loaded as

Unload the reg hive.

C:\Windows\system32>reg unload HKLM\test

The operation completed successfully.

Unmount the image.

C:\ImageX>imagex /unmount /commit c:\mount

ImageX Tool for Windows
Copyright (C) Microsoft Corp. 1981-2005. All rights reserved.

Unmounting: [c:\mount]...

Successfully unmounted image.

It really is that simple.  Changes to be made without having to apply, sysprep, and recapture the image.  You could leverage this as a tool in a variety of ways such as to embed a script to run application installations after the image has been deployed, automate activation using slmgr.vbs, etc.

Comments

  • Anonymous
    January 01, 2003
    PingBack from http://www.vistapcguy.net/?p=76

  • Anonymous
    January 01, 2003
    How to load User Hive ? I would like to modify Default User Settings.

  • Anonymous
    August 12, 2008
    I don't have the mount command in windows xp. Where do I get it? I can do the rest of the things but when I run mount>reg mount is not recognized command. Thank you.

  • Anonymous
    September 08, 2008
    The comment has been removed

  • Anonymous
    December 31, 2008
    it should be noted that when using imagex that you must select the correct index to modify containing the correct version of Vista (ex. Business, Ultimate, etc.).  this is the "1" in "C:ImageX>imagex /mountrw install.wim 1 c:mount".  you can find the correct index number by doing a "imagex /info install.wim" and noting the index number in the report.

  • Anonymous
    July 09, 2009
    The comment has been removed

  • Anonymous
    February 02, 2011
    The comment has been removed

  • Anonymous
    February 02, 2011
    Make sure wimgapi.dll is registered.

  • Anonymous
    February 27, 2011
    I have same question with Mike And I do like Michael said but it not work Keep "Acess is denied" Please help me

  • Anonymous
    May 16, 2011
    You must close the registry editor - then it works.

  • Anonymous
    July 19, 2012
    For those facing  "Acess is denied" you must have to type the "test" word as it is showing in the given command, i have type the test word in caps ON : C:mount>reg load HKLMTEST c:mountwindowssystem32configsoftware

  • Anonymous
    April 25, 2013
    Marcus.. For XP use REG LOAD HKLMDefUsr "c:documents and settingsdefaultntuser.dat" For Windows Vista and up use... REG LOAD HKLMDefUsr "c:usersdefaultntuser.dat" When you're done editing use (All windows versions)... REG UNLOAD HKLMDefUsr HTH. Shaun.

  • Anonymous
    September 28, 2014
    Holycrap! I realize this is from 2006 but, you just saved me hours of work! THANK YOU!
    works perfectly with a Windows 7 pro image. mount image, load registry, make changes, unload registry, commit and unmount.

  • Anonymous
    November 28, 2014
    unbelievable!! :-)
    It work for me with after a disk2vhd from win2k8R2 physical server to hyper-v2012 R2 VM
    Thanks

  • Anonymous
    April 08, 2015
    The comment has been removed