Off Campus

Michael Greene

Edit the registry on a mounted WIM

Edit the registry on a mounted WIM

  • Comments 12
  • Likes

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
  • PingBack from http://www.vistapcguy.net/?p=76

  • 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.

  • Dimo:  You need to install Imagex.  Google "Imagex" or search on Microsoft's site.  An alternative is Gimagex which is a GUI-based frontend for imagex developed by a third party.  Imagex is command-line based and is what you need to run the commands shown in this article.

  • 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.

  • JP,

    You need to download the Windows Automated Installation Kit to get imagex, peimg, and the rest of the command-line tools.

  • I tried following this exactly, but kept getting an "Access Denied" error. For some reason the /mountrw switch isn't allowing me to even load the reg hive. I've looked all over the internet for a solution, but found nothing. I can manually go through the folders and change the permissions on things, but can't do it through the cmd line.

    Any ideas?

  • Make sure wimgapi.dll is registered.

  • I have same question with Mike

    And I do like Michael said but it not work

    Keep "Acess is denied"

    Please help me

  • You must close the registry editor - then it works.

  • 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 HKLM\TEST c:\mount\windows\system32\config\software

  • How to load User Hive ?

    I would like to modify Default User Settings.

  • Marcus..

    For XP use

    REG LOAD HKLM\DefUsr "c:\documents and settings\default\ntuser.dat"

    For Windows Vista and up use...

    REG LOAD HKLM\DefUsr "c:\users\default\ntuser.dat"

    When you're done editing use (All windows versions)...

    REG UNLOAD HKLM\DefUsr

    HTH. Shaun.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment