Jump to content


  • 0
anyweb

How can I migrate registry keys from one location on the source to another on the destination

Question

if you want to migrate registry keys from one location to another (provided that they are detected) then use the following code in a custom XML file

 

<?xml version="1.0" encoding="UTF-8"?>
<migration urlid="http://www.microsoft.com/migration/1.0/migxmlext/WNB_move_reg_keys">
<!-- WNB_move_reg_keys.xml is basically a customized version of MigUser.xml -->
<_locDefinition>
 <_locDefault _loc="locNone"></_locDefault>
 <_locTag _loc="locData">displayName</_locTag>
</_locDefinition>

<!-- This component migrates Old Reg Keys and moves them to NEW locations provided that the key exists -->
<component context="User" type="Application">
 <displayName _locID="regkeymove_user">Move old reg keys to new location</displayName>
 <role role="Settings">
  <detects>
<detect>
<condition>MigXmlHelper.DoesObjectExist("Registry","HKLM\SOFTWARE\CUSTOM [CUSTOMval#1]")</condition>
</detect>
  </detects>
  <rules>
<include>
<objectSet>
 	<pattern type="Registry">HKLM\SOFTWARE\CUSTOM [CUSTOMval#1]</pattern>
 	<pattern type="Registry">HKLM\SOFTWARE\CUSTOM [CUSTOMval#2]</pattern>
</objectSet>
</include>
<locationModify script="MigXmlHelper.ExactMove('HKLM\SOFTWARE\CUSTOM [PrevCUSTOMval#1]')">
<objectSet>
 	<pattern type="Registry">HKLM\SOFTWARE\CUSTOM [CUSTOMval#1]</pattern>
</objectSet>
</locationModify>
<locationModify script="MigXmlHelper.ExactMove('HKLM\SOFTWARE\CUSTOM [PrevCUSTOMval#2]')">
<objectSet>
 	<pattern type="Registry">HKLM\SOFTWARE\CUSTOM [CUSTOMval#2]</pattern>
</objectSet>
</locationModify>
  </rules>
 </role>
</component>
</migration>

 

this code checks if the following registry key exists HKLM\SOFTWARE\CUSTOM\CUSTOMval#1 and if it does, it migrates the following two registry keys from the SOURCE pc

 

HKLM\SOFTWARE\CUSTOM\CUSTOMval#1

HKLM\SOFTWARE\CUSTOM\CUSTOMval#2

 

to the following locations on the DESTINATION pc

 

HKLM\SOFTWARE\CUSTOM\PrevCUSTOMval#1

HKLM\SOFTWARE\CUSTOM\PrevCUSTOMval#2

 

Note: if you are using a 64 bit OS with a 32bit application (X86) that you'll probably want to change the path statements

 

for example, change

 

HKLM\SOFTWARE\CUSTOM [CUSTOMval#1]


 

to

 

HKLM\SOFTWARE\Wow6432Node\CUSTOM\ [CUSTOMval#1]

 

cheers

niall

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.