Q. How can I make registry changes to an offline Virtual Hard Disk (VHD) with Windows 7 or Windows Server 2008 R2?

A. It's possible to mount registry stores from other OSs into the registry editor and make changes, and this applies equally to VHD files. Mount the VHD using Disk Administrator or Diskpart with the attach command, and you can then view the VHD file system. Launch the registry editor, load the hive of interest from the %systemroot%\system32\config of the mounted VHD, then make the changes and unload.

You can do all of this from the command line. Assuming the E: drive is the mounted VHD, to stop dynamic VHD expansion for the VHD (as discussed in the previous FAQ), run the following:

reg load HKLM\VHDSYS e:\windows\system32\config\system
reg add HKLM\VHDSYS\ControlSet001\services\FsDepends\Parameters /v VirtualDiskExpandOnMount /t REG_DWORD /d 4 /f
reg unload HKLM\VHDSYS
<br />

Note that all I'm doing is mounting the system registry area of the VHD into the HKEY_LOCAL_MACHINE\VHDSYS namespace, modifying that namespace, then unloading. It's actually not a complex process, and you can use this technique for many types of change.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish