How To Include Files and Settings

When you specify the migration .xml files, USMT migrates the settings and components specified in What Does USMT 3.0 Migrate?. To include additional files and settings, we recommend that you create a custom .xml file and then include this .xml file on both command lines. This way, you can keep your changes separate from the default .xml files and it may be easier to track your modifications.

Note

You may need to adjust the width of the sidebar on the left to view this topic. For example, if you have to scroll to read the text, move the sidebar to the left.

In this topic

  • To migrate a single registry key
  • To migrate a specific folder
    • To migrate a folder from a specific drive
    • To migrate a folder from any location
  • To migrate a specific file type
  • To migrate a specific file
    • To migrate a file from a folder
    • To migrate a file from any location
  • Additional Information

To migrate a single registry key

The following .xml file migrates a single registry key.

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

To migrate a specific folder

The following examples show how to migrate a folder from a specific drive, and from any location on the computer.

To migrate a folder from a specific drive

  • Including subfolders. The following .xml file migrates all files and subfolders from C:\EngineeringDrafts to the destination computer.

    <migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
    <component type="Documents" context="System">
      <displayName>Component to migrate all Engineering Drafts Documents including subfolders</displayName>
      <role role="Data">
        <rules>
          <include>
            <objectSet>
              <pattern type="File">C:\EngineeringDrafts\* [*]</pattern>
            </objectSet>
          </include>
        </rules>
      </role>
    </component>
    </migration>
    
  • Excluding subfolders. The following .xml file migrates all files from C:\EngineeringDrafts, but does not migrate any subfolders within C:\EngineeringDrafts.

    <migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
    <component type="Documents" context="System">
      <displayName>Component to migrate all Engineering Drafts Documents without subfolders</displayName>
      <role role="Data">
        <rules>
          <include>
            <objectSet>
              <pattern type="File"> C:\EngineeringDrafts\ [*]</pattern>
            </objectSet>
          </include>
        </rules>
      </role>
    </component>
    </migration>
    

To migrate a folder from any location

The following .xml file migrates all files and subfolders of the EngineeringDrafts folder from any drive on the computer. If multiple folders exist with the same name all such folders will get migrated.

<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="System">
  <displayName>Component to migrate all Engineering Drafts Documents folder on any drive on the computer </displayName>
  <role role="Data">
    <rules>
         <include>
            <objectSet>
         <script>MigXmlHelper.GenerateDrivePatterns ("\EngineeringDrafts\* [*] ", "Fixed")</script>            
         <script>MigXmlHelper.GenerateDrivePatterns ("*\EngineeringDrafts\* [*] ", "Fixed")</script>            
       </objectSet>
          </include>
    </rules>
  </role>
</component>
</migration>

The following .xml file migrates all files and subfolders of the EngineeringDrafts folder from where ever it exists on the C: drive. If multiple folders exist with the same name all such folders will get migrated

<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="System">
  <displayName>Component to migrate all Engineering Drafts Documents EngineeringDrafts folder from where ever it exists on the C: drive </displayName>
  <role role="Data">
    <rules>
         <include>
            <objectSet>                 
<pattern type="File"> C:\*\EngineeringDrafts\* [*]</pattern>
<pattern type="File"> C:\EngineeringDrafts\* [*]</pattern>
       </objectSet>
          </include>
    </rules>
  </role>
</component>
</migration>

To migrate a file type into a specific folder

The following .xml file migrates .mp3 files located in the fixed drives on the source computer into the 'C:\Music folder on the destination computer.

<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="System">
  <displayName>All .mp3 files to My Documents</displayName>
  <role role="Data">
    <rules>
      <include>
        <objectSet>
          <script>MigXmlHelper.GenerateDrivePatterns ("* [*.mp3]", "Fixed")</script>
        </objectSet>
      </include>
      <!-- Migrates all the .mp3 files in the store to the C:\Music folder during LoadState -->
      <locationModify script="MigXmlHelper.Move('C:\Music')">
        <objectSet>
          <script>MigXmlHelper.GenerateDrivePatterns ("* [*.mp3]", "Fixed")</script>
        </objectSet>
      </locationModify>
    </rules>
  </role>
</component>
</migration> 

To migrate a specific file

The following examples show how to migrate a file from a specific folder, and how to migrate a file from any location.

  • To migrate a file from a folder. The following .xml file migrates only Sample.doc from C:\EngineeringDrafts to the destination computer.

    <migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
    <component type="Documents" context="System">
      <displayName>Component to migrate all Engineering Drafts Documents</displayName>
      <role role="Data">
        <rules>
          <include>
            <objectSet>
              <pattern type="File"> C:\EngineeringDrafts\ [Sample.doc]</pattern>
            </objectSet>
          </include>
        </rules>
      </role>
    </component>
    </migration>
    
  • To migrate a file from any location. To migrate Sample.doc from where ever it exists on the C: drive, use <pattern> as follows. If multiple files exist with the same name on the C: drive, then all of these files will be migrated.

    <pattern type="File"> C:\* [Sample.doc] </pattern>
    

    To migrate Sample.doc from any drive on the computer, use <script> as follows. If multiple files exist with the same name, all such files will get migrated.

    <script>MigXmlHelper.GenerateDrivePatterns("* [sample.doc]", “Fixed”)</script>
    

Additional information