windows - How to migrate registry entries with PowerShell with Get-Item : Set-Item and ExportTo-CliXml -
i trying export selective registry entries, preferences , configurations various software applications, , them import them on new machine.
get-childitem registry::hkey_current_user\software\microsoft\office\14.0\onenote -recurse | export-clixml -depth 3 -path onenote.xml
and reverse process on machine @ different time using
import-clixml -path onenote.xml | set-item
this doesn't seem work it's not obvious why. conceptually feels though should work.
ideally next step able keys, filter them , store them in 1 file , restore them cleanly on machine.
this can done regedit, i'm curious how done powershell.
rather creating keys if don't exist , setting values import-clixml
command creates values under default property names in keys correspond paths of key. example:
on destination machine, target key such as:
hkey_current_user\software\microsoft\office\14.0\onenote\opennotebooks
will contain default item has value:
"hkey_current_user\software\microsoft\office\14.0\onenote\opennotebooks"
rather expected properties source key.
for context, @ basic level, wish may accomplished by:
reg export hkey_current_user\software\microsoft\office\14.0\onenote onenote.reg
to create registry file containing keys values, then.
reg import onenote.reg
on target machine load them. easy simple "dump , restore" operation, less flexible if 1 wishes process keys using logic first.
there's couple of reasons why won't work expected.
firstly in set-item
documentation notes section states:
in registry drives, hklm: , hkcu:, set-item changes data in (default) value of registry key. create , change names of registry keys, use new-item , rename-item. change names , data in registry values, use new-itemproperty, set-itemproperty, , rename-itemproperty.
so right off mark we're destined not working you'd intuitively think.
secondly if @ output import-clixml -path onenote.xml
, there's no registry value type information provided e.g. dword
, qword
etc, therefore tool using input won't know how construct key's values because there's no type hinting.
you're better off sticking old reg.exe
tool. it's proven , predictable in behaviour. it's not hard parse .reg
file if need tweak values along way.
Comments
Post a Comment