Copy Registry Hives

by May 27, 2011

You can use Copy-Item to quickly copy entire structures of registry keys and sub-keys in a matter of milliseconds. Take a look at this example – it creates a new registry key in HKCU and then copies a key with all of its values and sub-keys from HKLM to the new key:

PS> Md Registry::HKCU\Software\Testkey
PS> Copy-Item -Path Registry::HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall `
-Destination Registry::HKCU\Software\Testkey -Recurse

 

Note the use of -Recurse to get a complete copy of all sub-keys and values.

 

Twitter This Tip!
ReTweet this Tip!