ファイルと設定の除外
移行 .xml ファイル (MigApp.xml、MigDocs.xml、MigUser.xml) を指定した場合、ユーザー状態移行ツール (USMT) 5.0 は「USMT によって移行されるもの」で説明されている設定とコンポーネントを移行します。カスタム .xml ファイルを作成すると、移行対象に含めるものと移行対象から除外するものをさらに細かく指定できます。また、Config.xml ファイルを作成して、移行対象からコンポーネント全体を除外することもできます。ただし、移行 .xml ファイルや Config.xml ファイルを使ってユーザーを除外することはできまん。移行対象に含めるユーザーと移行対象から除外するユーザーを指定するには、ScanState ツールのコマンド ラインでユーザー オプションを使う必要があります。詳しくは、「ScanState の構文」をご覧ください。
このトピックの内容:
カスタム .xml ファイルの作成。次の要素を使って、除外するものを指定します。
<include> と <exclude>: <include> 要素と <exclude> 要素を使い、条件を指定してオブジェクトを除外できます。たとえば、C:\ ドライブにある、.mp3 ファイル以外のすべてのファイルを移行できます。これらの要素には、競合と優先度が適用されることに注意してください。
<unconditionalExclude>: グローバルにデータを除外するには、<unconditionalExclude> 要素を使います。この要素は、.xml ファイルに含まれる他のすべての <include> 規則と <exclude> 規則よりも優先されます。したがって、この要素を使うと、.xml ファイルで指定されている <include> 規則に関係なく、オブジェクトが除外されます。たとえば、コンピューター上のすべての .mp3 ファイルを除外したり、C:\UserData のすべてのファイルを除外したりできます。
Config.xml ファイルの作成: 移行対象からコンポーネント全体を除外するには、Config.xml ファイルを作成して変更します。たとえば、このファイルを使って、既定のアプリケーションのどれか 1 つに関する設定を除外できます。また、Windows が実行されているコンピューターに移行されるオペレーティング システム設定を除外する場合は、Config.xml ファイルを作成して変更する必要があります。このファイルを使ったコンポーネントの除外は、移行の規則や構文に精通している必要がないため、移行 .xml ファイルを編集するよりも簡単です。
カスタム .xml ファイルの作成
既定の移行 .xml ファイルを変更するのではなく、カスタム .xml ファイルを作成することをお勧めします。カスタム .xml ファイルを使うと、変更を既定の .xml ファイルから分離して、変更の履歴を管理しやすくなります。
<include> と <exclude>
移行 .xml ファイル (MigApp.xml、MigDocs.xml、MigUser.xml) には <component> 要素が含まれています。これは通常、自己完結型のコンポーネントや、Microsoft(R) Office Outlook(R)、Word などのアプリケーションを表します。これらのコンポーネントに関連付けられているファイルとレジストリ設定を除外するには、<include> 要素と <exclude> 要素を使います。たとえば、これらの要素を使ってパターン X のすべてのファイルと設定を移行する際に、パターン Y (Y は X よりも限定的) のファイルと設定を除外できます。これらの要素の構文については、「USMT XML リファレンス」をご覧ください。
注意
<exclude> 規則を指定する場合は、対応する <include> 規則を必ず指定する必要があります。<include> 規則を指定しないと、特定のファイルや設定を対象に含めることができません。これらは既に移行対象から除外する設定になっています。したがって、単独の <exclude> 規則は不要です。
例 1: C:\ にある、.mp3 ファイル以外のすべてのファイルを移行する方法
例 2: C:\Data\tmp 内のファイルを除き、C:\Data 内のすべてのファイルを移行する方法
例 3: フォルダー内のファイルを除外し、すべてのサブフォルダーを含める方法
例 4: 特定のフォルダーのファイルを除外する方法
例 5: 任意の場所のファイルを除外する方法
例 1: C:\ にある、.mp3 ファイル以外のすべてのファイルを移行する方法
次の .xml ファイルを使うと、.mp3 ファイルを除いて、C: ドライブにあるすべてのファイルが移行されます。
<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/mp3files">
<!-- This component migrates all files except those with .mp3 extension-->
<component type="Documents" context="UserAndSystem">
<displayName _locID="miguser.sharedvideo">MP3 Files</displayName>
<role role="Data">
<rules>
<include filter='MigXmlHelper.IgnoreIrrelevantLinks()'>
<objectSet>
<pattern type="File">C:\* [*]</pattern>
</objectSet>
</include>
<exclude>
<objectSet>
<pattern type="File">C:\* [*.mp3]</pattern>
</objectSet>
</exclude>
</rules>
</role>
</component>
</migration>
例 2: C:\Data\tmp 内のファイルを除き、C:\Data 内のすべてのファイルを移行する方法
次の .xml ファイルを使うと、C:\Data\tmp 内のファイルとサブフォルダーを除いて、C:\Data 内のすべてのファイルとサブフォルダーが移行されます。
<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="System">
<displayName _locID="miguser.sharedvideo">Test component</displayName>
<role role="Data">
<rules>
<include>
<objectSet>
<pattern type="File">C:\Data\* [*]</pattern>
</objectSet>
</include>
<exclude>
<objectSet>
<pattern type="File"> C:\Data\temp\* [*]</pattern>
</objectSet>
</exclude>
</rules>
</role>
</component>
</migration>
例 3: フォルダー内のファイルを除外し、すべてのサブフォルダーを含める方法
次の .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>
<exclude>
<objectSet>
<pattern type="File"> C:\EngineeringDrafts\ [*]</pattern>
</objectSet>
</exclude>
</rules>
</role>
</component>
</migration>
例 4: 特定のフォルダーのファイルを除外する方法
次の .xml ファイルを使うと、C:\EngineeringDrafts 内の Sample.doc ファイルを除いて、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 except Sample.doc</displayName>
<role role="Data">
<rules>
<include>
<objectSet>
<pattern type="File"> C:\EngineeringDrafts\* [*]</pattern>
</objectSet>
</include>
<exclude>
<objectSet>
<pattern type="File"> C:\EngineeringDrafts\ [Sample.doc]</pattern>
</objectSet>
</exclude>
</rules>
</role>
</component>
</migration>
例 5: 任意の場所のファイルを除外する方法
C: ドライブ上のすべての場所の Sample.doc ファイルを除外するには、<pattern> 要素を使います。C: ドライブ上に同じ名前のファイルが複数存在する場合は、それらのファイルがすべて除外されます。
<pattern type="File"> C:\* [Sample.doc] </pattern>
コンピューター上の任意のドライブの Sample.doc ファイルを除外するには、<script> 要素を使います。同じ名前のファイルが複数存在する場合は、それらのファイルがすべて除外されます。
<script>MigXmlHelper.GenerateDrivePatterns("* [sample.doc]", "Fixed")</script>
<unconditionalExclude>
他の <include> 規則と <exclude> 規則とは関係なく、あるファイルの種類を移行対象から除外する場合は、<unconditionalExclude> 要素を使います。この要素は、すべてのコンポーネントからグローバルにオブジェクトを除外します。たとえば、コンピューターにあるすべての .mp3 ファイルを除外する場合に、この要素を使います。また、別の方法で C:\UserData をバックアップする場合に、フォルダー全体を移行対象から除外することができます。除外したファイルを必要とするアプリケーションがある場合は、移行先コンピューターでそのアプリケーションが適切に機能しなくなる可能性があるため、この要素を使う場合は注意してください。この要素の構文については、「USMT XML リファレンス」をご覧ください。
例 1: すべての .mp3 ファイルを除外する方法
例 2: 特定のドライブ上のすべてのファイルを除外する方法
例 3: レジストリ キーを除外する方法
例 4: C:\Windows と C:\Program Files を除外する方法
例 1: すべての .mp3 ファイルを除外する方法
次の .xml ファイルを使うと、すべての .mp3 ファイルが移行対象から除外されます。
<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/excludefiles">
<component context="System" type="Documents">
<displayName>Test</displayName>
<role role="Data">
<rules>
<unconditionalExclude>
<objectSet>
<script>MigXmlHelper.GenerateDrivePatterns ("* [*.mp3]", "Fixed")</script>
</objectSet>
</unconditionalExclude>
</rules>
</role>
</component>
</migration>
例 2: 特定のドライブ上のすべてのファイルを除外する方法
次の .xml ファイルを使うと、C: ドライブ上にあるファイルのみが除外されます。
<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/allfiles">
<component type="Documents" context="System">
<displayName>Test</displayName>
<role role="Data">
<rules>
<unconditionalExclude>
<objectSet>
<pattern type="File">c:\*[*]</pattern>
</objectSet>
</unconditionalExclude>
</rules>
</role>
</component>
</migration>
例 3: レジストリ キーを除外する方法
次のファイルは、HKey_Current_User レジストリ キーとそのすべてのサブキーを無条件で除外する .xml ファイルです。
<?xml version="1.0" encoding="UTF-8"?>
<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/miguser">
<component type="Documents" context="User">
<displayName>Test</displayName>
<role role="Data">
<rules>
<include>
<objectSet>
<pattern type="Registry">HKCU\testReg[*]</pattern>
</objectSet>
</include>
<unconditionalExclude>
<objectSet>
<pattern type="Registry">HKCU\*[*]</pattern>
</objectSet>
</unconditionalExclude>
</rules>
</role>
</component>
</migration>
例 4: C:\Windows と C:\Program Files を除外する方法
次のファイルは、C:\Windows と C:\Program Files のシステム フォルダーを無条件で除外する .xml ファイルです。<unconditionalExclude> 要素は <include> 要素よりも優先されるため、*.docx ファイル、*.xls ファイル、*.ppt ファイルは一切移行されません。
<?xml version="1.0" encoding="UTF-8"?>
<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/miguser">
<component type="Documents" context="System">
<displayName>Test</displayName>
<role role="Data">
<rules>
<include>
<objectSet>
<script>MigXmlHelper.GenerateDrivePatterns ("* [*.doc]", "Fixed")</script>
<script>MigXmlHelper.GenerateDrivePatterns ("* [*.xls]", "Fixed")</script>
<script>MigXmlHelper.GenerateDrivePatterns ("* [*.ppt]", "Fixed")</script>
</objectSet>
</include>
<unconditionalExclude>
<objectSet>
<pattern type="File">C:\Program Files\* [*]</pattern>
<pattern type="File">C:\Windows\* [*]</pattern>
</objectSet>
</unconditionalExclude>
</rules>
</role>
</component>
</migration>
Config.xml ファイルの作成
コンポーネントを移行対象から除外する場合は、Config.xml ファイルを作成して変更します。このファイルを使ったコンポーネントの除外は、移行の規則や構文に精通している必要がないため、移行 .xml ファイルを編集するよりも簡単です。Config.xml は、ScanState ツールの /genconfig コマンド ライン オプションを使って作成できるオプション ファイルです。たとえば、Config.xml ファイルを使って、既定のアプリケーションのどれか 1 つに関する設定を除外できます。また、Windows が実行されているコンピューターに移行されるオペレーティング システム設定を除外する場合は、このファイルを作成して変更する必要があります。
既定のアプリケーションに関する設定を除外するには: Config.xml ファイルの <Applications> セクションで、アプリケーションに対して
migrate="no"
を指定します。オペレーティング システムの設定を除外するには: <WindowsComponents> セクションで、設定に対して
migrate="no"
を指定します。マイ ドキュメントを除外するには: <Documents> セクションで、マイ ドキュメントに対して
migrate="no"
を指定します。.xml ファイル内の <include> 規則は引き続き適用されることに注意してください。たとえば、マイ ドキュメント内のすべての .docx ファイルを含める規則がある場合、.docx ファイルは移行されますが、その他のファイルは移行されません。
詳しくは、「Config.xml ファイル」をご覧ください。
注意
Config.xml ファイルからコンポーネントを除外するには、migrate の値を "no" に設定します。対応する XML タグを Config.xml ファイルから削除してもコンポーネントは移行対象から除外されません。