Here is a tip for those of you that might be using .VHD files a lot, that you might not already be aware of...
VHDMount is a tool in Microsoft Virtual Server 2005 R2 SP1 which allows you to mount a virtual disk in Windows and browse/edit the contents directly.
If you do a custom installation of the product you can deselect all but this tool, in the event that you want to use it on a client OS, for example.
Syntax to plug in & mount a drive, specifying an optional drive letter (without a colon):
vhdmount /m {filename.vhd} [drive letter]
This creates an "undo disk" in your profile where any changes you make are recorded, and when you unplug the disk you have to specify whether to discard or commit those changes.
(You can work directly with the file instead of using undo disks by using the /f argument if you prefer.)
Syntax to unplug the drive and discard changes:
vhdmount /u /d {filename.vhd}
Syntax to unplug the drive and commit changes:
vhdmount /u /c {filename.vhd}
---
To add context menu ("right-click menu") options for mounting and dismounting virtual disks through Explorer, you can add some custom registry entries.
The code section below can be copy/pasted into a .reg file and imported by double-clicking it.
Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs.
For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base: 256986 Description of the Microsoft Windows Registry
If you use this tweak on Vista, you need to let the OS know that vhdmount.exe is an administrative tool and should run elevated, otherwise it will fail silently as it will default to using the "user" part of your security token:Code:Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell] @="Mount" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount - Commit] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount - Commit\command] @="\"C:\\Program Files\\Microsoft Virtual Server\\Vhdmount\\vhdmount.exe\" /u /c \"%1\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount - Discard] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount - Discard\command] @="\"C:\\Program Files\\Microsoft Virtual Server\\Vhdmount\\vhdmount.exe\" /u /d \"%1\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Mount] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Mount\command] @="\"C:\\Program Files\\Microsoft Virtual Server\\Vhdmount\\vhdmount.exe\" /m \"%1\"" [HKEY_CLASSES_ROOT\.vhd] @="Virtual.Machine.HD"
- Browse to the folder C:\Program Files\Microsoft Virtual Server\Vhdmount
- Right-click on vhdmount.exe, click Properties
- Select the Compatibility tab
- Tick the box "Run this program as an administrator" and click OK
Now you can browse to a .vhd file produced by Virtual PC, Virtual Server or Vista's Complete PC Backup and right-click it to work with them outside a virtual environment.
(Note I have assumed the path in which Virtual Server is installed is "C:\Program Files\Microsoft Virtual Server" - if you install to another location then you will need to change the .reg file before importing it.)