ファイルと設定を含める
移行 .xml ファイルを指定した場合、ユーザー状態移行ツール (USMT) 5.0 は「USMT によって移行されるもの」で指定されている設定とコンポーネントを移行します。その他のファイルと設定を含めるには、カスタム .xml ファイルを作って、ScanState と LoadState の両方のコマンドを使うときにこのファイルを含めることをお勧めします。カスタム .xml ファイルを作ると、変更を既定の .xml ファイルから分離して、変更の履歴を管理しやすくなります。
このトピックの内容:
1 つのレジストリ キーを移行する
特定のフォルダーを移行する
特定のドライブのフォルダーを移行する
任意の場所のフォルダーを移行する
ファイルの種類を特定のフォルダーに移行する
特定のファイルを移行する
1 つのレジストリ キーを移行する
次の .xml ファイルは、1 つのレジストリ キーを移行します。
<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>
特定のフォルダーを移行する
以下の例は、特定のドライブのフォルダーと、コンピューター上の任意の場所のフォルダーを移行する方法を示しています。
特定のドライブのフォルダーを移行する
サブフォルダーを含める場合: 次の .xml ファイルは、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 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="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>
任意の場所のフォルダーを移行する
次の .xml ファイルは、コンピューターのすべてのドライブの 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 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 ファイルは、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 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="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>
特定のファイルを移行する
以下の例は、特定のフォルダーのファイルと、任意の場所のファイルを移行する方法を示しています。
フォルダーのファイルを移行するには: 次の .xml ファイルは、移行元コンピューターの C:\EngineeringDrafts にある Sample.doc ファイルだけを移行先コンピューターに移行します。
<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>
任意の場所のファイルを移行するには: C:\ ドライブの任意の場所にある Sample.doc ファイルを移行するには、次の例のように、<pattern> 要素を使います。C:\ ドライブに同じ名前のファイルが複数ある場合は、この名前のすべてのファイルが移行されます。
<pattern type="File"> C:\* [Sample.doc] </pattern>
コンピューター上の任意のドライブの Sample.doc ファイルを移行するには、次の例のように、<script> を使います。同じ名前のファイルが複数ある場合は、この名前のすべてのファイルが移行されます。
<script>MigXmlHelper.GenerateDrivePatterns("* [sample.doc]", "Fixed")</script>