virt-win-reg (1) Linux Manual Page
NAME
virt-win-reg – Export and merge Windows Registry entries from a Windows guest
SYNOPSIS
virt - win - reg domname 'HKLM\Path\To\Subkey' virt - win - reg domname 'HKLM\Path\To\Subkey' name virt - win - reg domname 'HKLM\Path\To\Subkey' @virt - win - reg-- merge domname[input.reg...] virt - win - reg[--options] disk.img... #instead of domname
WARNING
You must not use "virt-win-reg" with the –merge option on live virtual machines. If you do this, you will get irreversible disk corruption in the VM. "virt-win-reg" tries to stop you from doing this, but doesn’t catch all cases.
Modifying the Windows Registry is an inherently risky operation. The format is deliberately obscure and undocumented, and Registry changes can leave the system unbootable. Therefore when using the –merge option, make sure you have a reliable backup first.
DESCRIPTION
This program can export and merge Windows Registry entries from a Windows guest.
The first parameter is the libvirt guest name or the raw disk image of a Windows guest.
If –merge is not specified, then the chosen registry key is displayed/exported (recursively). For example:
$ virt-win-reg Windows7 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft'
You can also display single values from within registry keys, for example:
$ cvkey='HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion' $ virt-win-reg Windows7 $cvkey ProductName Windows 7 Enterprise
With –merge, you can merge a textual regedit file into the Windows Registry:
$ virt-win-reg --merge Windows7 changes.reg
NOTE
This program is only meant for simple access to the registry. If you want to do complicated things with the registry, we suggest you download the Registry hive files from the guest using libguestfs(3) or guestfish(1) and access them locally, eg. using hivex(3), hivexsh(1) or hivexregedit(1).
OPTIONS
–help- Display brief help.
–version- Display version number and exit.
–debug- Enable debugging messages.
-cURI–connectURI- If using libvirt, connect to the given URI. If omitted, then we connect to the default libvirt hypervisor.
If you specify guest block devices directly, then libvirt is not used at all.
–formatraw- Specify the format of disk images given on the command line. If this is omitted then the format is autodetected from the content of the disk image.
If disk images are requested from libvirt, then this program asks libvirt for this information. In this case, the value of the format parameter is ignored.
If working with untrusted raw-format guest disk images, you should ensure the format is always specified.
–merge- In merge mode, this merges a textual regedit file into the Windows Registry of the virtual machine. If this flag is not given then virt-win-reg displays or exports Registry entries instead.
Note that –merge is unsafe to use on live virtual machines, and will result in disk corruption. However exporting (without this flag) is always safe.
–encodingUTF-16LE|ASCII- When merging (only), you may need to specify the encoding for strings to be used in the hive file. This is explained in detail in “ENCODING STRINGS” in Win::Hivex::Regedit(3).
The default is to use UTF-16LE, which should work with recent versions of Windows.
–unsafe-printable-strings- When exporting (only), assume strings are UTF-16LE and print them as strings instead of hex sequences. Remove the final zero codepoint from strings if present.
This is unsafe and does not preserve the fidelity of strings in the original Registry for various reasons:
-
- •
- Assumes the original encoding is UTF-16LE. ASCII strings and strings in other encodings will be corrupted by this transformation.
- •
- Assumes that everything which has type 1 or 2 is really a string and that everything else is not a string, but the type field in real Registries is not reliable.
- •
- Loses information about whether a zero codepoint followed the string in the Registry or not.
-
This all happens because the Registry itself contains no information about how strings are encoded (see “ENCODING STRINGS” in Win::Hivex::Regedit(3)).
You should only use this option for quick hacking and debugging of the Registry contents, and never use it if the output is going to be passed into another program or stored in another Registry.
SUPPORTED SYSTEMS
The program currently supports Windows NT-derived guests starting with Windows XP through to at least Windows 8.
The following Registry keys are supported:
- "HKEY_LOCAL_MACHINE\SAM"
- "HKEY_LOCAL_MACHINE\SECURITY"
- "HKEY_LOCAL_MACHINE\SOFTWARE"
- "HKEY_LOCAL_MACHINE\SYSTEM"
- "HKEY_USERS\.DEFAULT"
- "HKEY_USERS\SID"
- where
SID is a Windows User SID (eg. "S-1-5-18").- "HKEY_USERS
