Appendix B: Creating a Custom.xml File

Best practices concerning the USMT prescribe the use of a custom migration control file (custom.xml). This appendix provides procedural information for creating this custom.xml file. The following excerpts from USMT.chm offer specific guidance about how to use a custom.xml file to migrate application settings and specific files and folders. See “How to Change Default Behavior” in USMT.chm for more examples.

Note   All code shown in these examples can be copied directly from USMT.chm. Because of space considerations, some code text below wraps to the next line.

On This Page

To Migrate a Specific Folder To Migrate a Specific Folder
To Migrate a Single Registry Key To Migrate a Single Registry Key
To Reroute a Specific File To Reroute a Specific File
To Migrate Cookies and Network Drives To Migrate Cookies and Network Drives

To Migrate a Specific Folder

To migrate a specific folder, create a custom.xml file, and then include this file in both the Scanstate and Loadstate Command Prompt windows. Listing 1 shows an example of XML code for migrating all files from C:\Engineering_Drafts to the destination computer.

Listing 1. Migrate Data Files from a Specified Folder

Note Some parts of the following code snippet have been displayed in multiple lines only for better readability. These should be entered in a single line.

<component type="Documents" context="System">
 <displayName>Engineering Drafts Documents</displayName>
 <role role="Data">
  <rules>
  <!-- migrate all directories and files present in
   c:\Engineering_Drafts folder -->
   <include>
    <objectSet>
     <pattern type="File">C:\Engineering_Drafts\* [*]</pattern>
    </objectSet>
   </include>
  </rules>
 </role>
</component>

To Migrate a Single Registry Key

To migrate a single registry key, create a custom.xml file, and then include this file in both the Scanstate and Loadstate Command Prompt windows. Listing 2 shows an example .xml file that migrates a single registry key.

Listing 2. Migrate a Single Registry Key

Note Some parts of the following code snippet have been displayed in multiple lines only for better readability. These should be entered in a single line.

<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
 <component type="Application">
 <displayName>Component to migrate only registry value string</displayName>
  <role role="Settings">
   <rules context="System">
    <include>
     <objectSet>
      <pattern type="Registry">HKLM\Software\Microsoft\Windows
      \CurrentVersion\Internet Settings\Cache [Persistent]</pattern>
     </objectSet>
    </include>
   </rules>
  </role>
 </component>
</migration>

To Reroute a Specific File

To reroute a specific file, create a custom.xml file, and then include this .xml file in both the Scanstate and Loadstate Command Prompt windows. Listing 3 shows an example of which sections of Sample.doc the User State Migration feature team must migrate from C:\Engineering_Drafts into the My Documents folder of every user.

Listing 3. Reroute Files During Migration

Note Some parts of the following code snippet have been displayed in multiple lines only for better readability. These should be entered in a single line.

<component type="Documents" context="User">
<displayName>file test component</displayName>
 <role role="Data">
  <rules>
   <include>
    <objectSet>
     <pattern type="File"> C:\Engineering_Drafts\[Sample.doc]</pattern>
     </objectSet>
      </include>
      <locationModify script="MigXmlHelper.RelativeMove
      ('C:\Engineering_Drafts',' %CSIDL_PERSONAL%')">
      <objectSet>
      <pattern type="File"> C:\Engineering_Drafts\[Sample.doc]</pattern>
     </objectSet>
    </locationModify>
   </rules>
  </role>
</component>

To Migrate Cookies and Network Drives

By default, USMT does not migrate cookies and network drives. The XML sample in Listing 4 can be used to migrate cookies and network drives.

Listing 4. Migrating Cookies and Network Drives

<!-- This component migrates Cookies -->
<component type="Documents" context="User">
 <displayName _locID="miguser.Cookies">Cookies</displayName>
  <paths>
    <path type="File">%csidl_cookies%</path>
  </paths>
  <role role="Settings">
    <detects>           
      <detect>
<condition>MigXmlHelper.DoesObjectExist("File","%csidl_cookies%")
</condition>
      </detect>
    </detects>           
    <rules>
      <include filter='MigXmlHelper.IgnoreIrrelevantLinks()'>
        <objectSet>
           <pattern type="File">%csidl_cookies%\* [*]</pattern>
        </objectSet>
       </include>
    </rules>
  </role>
</component>
<!-- This component migrates Network Drive settings -->
<component context="User" type="System" defaultSupported="FALSE">
 <displayName locID="migsys.NetworkDrive">NetworkDrive</displayName>
  <role role="Settings">
    <detects>
      <detect>
       <condition>MigXmlHelper.DoesOSMatch("NT","*")</condition>
      </detect>
      <detect>
<condition negation="Yes">MigXmlHelper.IsOSLaterThan("NT","6.0")</condition>
      </detect>
    </detects>
    <rules>
      <include>
        <objectSet>
          <pattern type="Registry">HKCU\Network\* [*]</pattern>    
        </objectSet>
      </include>
    </rules>
  </role>
</component>

Download

Get the Microsoft Solution Accelerator for Business Desktop Deployment 2007

Update Notifications

Sign up to learn about updates and new releases

Feedback

Send us your comments or suggestions