ファイルと設定を含める

移行 .xml ファイルを指定すると、ユーザー状態移行ツール (USMT) は、「 USMT が移行する内容」で指定された設定とコンポーネントを移行します。 追加のファイルと設定を含めるために、Microsoft ではカスタム .xml ファイルを作成し、 コマンドと LoadState.exe コマンドの両方を使用するときにこのファイルをScanState.exe含める必要があります。 カスタム .xml ファイルを作成すると、既定の .xml ファイルとは別の変更を保持できます。 カスタム .xml ファイルを作成すると、変更を簡単に追跡できます。

1 つのレジストリ キーを移行する

次の .xml ファイルは、1 つのレジストリ キーを移行します。

<migration urlid="http://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>

特定のフォルダーを移行する

次の例では、特定のドライブから、およびコンピューター上の任意の場所からフォルダーを移行する方法を示します。

特定のドライブからフォルダーを移行する

  • サブフォルダーを含む。 次の .xml ファイルは、すべてのファイルとサブフォルダーを C:\EngineeringDrafts 移行先コンピューターに移行します。

    <migration urlid="http://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>
    
  • サブフォルダーを除外します。 次の .xml ファイルは、 から C:\EngineeringDraftsすべてのファイルを移行しますが、 内 C:\EngineeringDraftsのサブフォルダーは移行されません。

    <migration urlid="http://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>
    

任意の場所からフォルダーを移行する

次の .xml ファイルは、コンピューター上の任意の EngineeringDrafts ドライブからフォルダーのすべてのファイルとサブフォルダーを移行します。 同じ名前のフォルダーが複数存在する場合、この名前のすべてのファイルが移行されます。

<migration urlid="http://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>

次の .xml ファイルは、ドライブ上の任意の EngineeringDrafts 場所からフォルダーのすべてのファイルとサブフォルダーを C:\ 移行します。 同じ名前の複数のフォルダーが存在する場合、それらはすべて移行されます。

<migration urlid="http://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>

ファイルの種類を特定のフォルダーに移行する

次の .xml ファイルは、 .mp3 ソース コンピューター上の指定したドライブにあるファイルを、コピー先コンピューターの C:\Music フォルダーに移行します。

<migration urlid="http://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="System">
  <displayName>All .mp3 files to the Documents folder</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> 

特定のファイルを移行する

次の例では、特定のフォルダーからファイルを移行する方法と、任意の場所からファイルを移行する方法を示します。

  • フォルダーからファイルを移行するには。の.xml ファイルは、ソース コンピューター上のC:\EngineeringDraftsファイルのみをSample.doc移行先のコンピューターに移行します。

    <migration urlid="http://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>
    
  • 任意の場所からファイルを移行するには。 次のSample.doc例に示すように、ドライブ上の任意の場所からファイルをC:\<移行するには、pattern> 要素を使用します。 ドライブに同じ名前の複数のファイルが存在する C:\ 場合、この名前のすべてのファイルが移行されます。

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

    コンピューター上の任意のドライブから Sample.doc ファイルを移行するには、次の例に示すようにスクリプト>を使用<します。 同じ名前の複数のファイルが存在する場合、この名前のすべてのファイルが移行されます。

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