ファイルと設定を除外する

ファイル、および MigUser.xml の移行.xmlMigApp.xmlMigDocs.xml指定すると、「USMT は何を移行しますか」で説明されているように、ユーザー状態移行ツール (USMT) によって一覧表示されている設定とコンポーネントが移行されます。カスタム .xml ファイルを作成して、移行に含めるか除外するかをさらに指定できます。 さらに、ファイルを Config.xml 作成して、コンポーネント全体を移行から除外することもできます。 ただし、移行 .xml ファイルまたはファイルを使用してユーザーを Config.xml 除外することはできません。 含めるユーザーと除外するユーザーを指定する唯一の方法は、 ScanState ツールのコマンド ラインでユーザー オプションを使用することです。 詳細については、ScanState 構文に関する記事の「ユーザー オプション」セクションを参照してください。

移行をカスタマイズし、ファイルと設定を含める方法と除外する方法は次のとおりです。

  • カスタム .xml ファイルを作成します。 次の要素を使用して、除外する対象を指定できます。

    • 含める要素と除外要素: <include> 要素と <exclude> 要素を使用して、条件を持つオブジェクトを除外できます。 たとえば、ドライブ内のすべてのファイルは、任意.mp3のファイルをC:\除いて移行できます。 これらの要素には 競合と優先順位 が適用されることに注意してください。

    • 無条件Exclude: <無条件Exclude> 要素を使用して、データをグローバルに除外できます。 この要素は、 .xml ファイル内の他のすべてのインクルードおよび除外ルールよりも優先されます。 したがって、この要素は、.xml ファイル内にあるその他<のインクルード> 規則に関係なく、オブジェクトを除外します。 たとえば、コンピューター上のすべての .mp3 ファイルを除外することも、C:\UserData のすべてのファイルを除外することもできます。

  • Config.xml ファイルを作成する: ファイルを Config.xml 作成および変更して、コンポーネント全体を移行から除外できます。 たとえば、このファイルを使用して、既定のアプリケーションの 1 つの設定を除外できます。 さらに、ファイルの作成と変更 Config.xml は、Windows を実行しているコンピューターに移行されるオペレーティング システム設定を除外する唯一の方法です。 移行規則と構文に精通している必要がないため、このファイルを使用したコンポーネントの除外は、移行 .xml ファイルを変更するよりも簡単です。

カスタム .xml ファイルを作成する

Microsoft では、既定の移行 .xml ファイルを変更するのではなく、カスタム .xml ファイルを作成することをお勧めします。 カスタム .xml ファイルを使用する場合、変更を既定の .xml ファイルとは別に保持できるため、変更の追跡が容易になります。

<include> and <exclude>

移行 .xml ファイル、MigApp.xmlMigDocs.xmlおよび MigUser.xmlにはコンポーネント>要素が含<まれています。これは通常、自己完結型コンポーネントまたは Microsoft Office Outlook や Word などのアプリケーションを表します。 これらのコンポーネントに関連付けられているファイルとレジストリ設定を除外するには、include> 要素と exclude 要素を使用します<>< たとえば、これらの要素を使用して、パターン X を持つすべてのファイルと設定を移行できます。ただし、パターン Y のファイルと設定 (Y は X より具体的です) を除きます。これらの要素の構文については、「 USMT XML リファレンス」を参照してください

除外ルールを指定する<場合は、常に対応するインクルード ルールを指定します。><> それ以外の場合、インクルード> ルールが指定されていない場合<、特定のファイルまたは設定は含まれません。 これらは既に移行から除外されています。 したがって、一致 <しない除外> 規則は不要です。

例 1: ファイルを除く.mp3すべてのファイルをC:\移行する方法

次の .xml ファイルは、.mp3ファイルを除き、C: ドライブ上にあるすべてのファイル 移行します。

<migration urlid="http://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 移行する方法 C:\Data\tmp

次の .xml ファイルは、 内 C:\Dataのすべてのファイルとサブフォルダーを移行します。ただし、 のファイルとサブフォルダーは C:\Data\tmp除きます。

<migration urlid="http://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="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>
                <exclude>
                    <objectSet>
                        <pattern type="File"> C:\EngineeringDrafts\ [*]</pattern>
                    </objectSet>
                </exclude>
            </rules>
        </role>
    </component>
</migration>

例 4: 特定のフォルダーからファイルを除外する方法

次の .xml ファイルは、 内のファイルを除き、 内C:\EngineeringDraftsのすべてのファイル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 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>

XML を使用してファイル、フォルダー、レジストリ キーを除外する方法の例

XML を使用してファイル、フォルダー、レジストリ キーを除外する方法の例を次に示します。 詳細については、「USMT XML リファレンス」を参照してください

例 1: すべての .mp3 ファイルを除外する方法

次の .xml ファイルは、移行からすべての .mp3 ファイルを除外します。

<migration urlid="http://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="http://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: レジストリ キーを除外する方法

次の .xml ファイルは、レジストリ キーとそのすべてのサブキーを HKEY_CURRENT_USER 無条件に除外します。

<?xml version="1.0" encoding="UTF-8"?>
<migration urlid="http://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

次の .xml ファイルは、 と C:\Program FilesC:\Windowsシステム フォルダーを無条件に除外します。 無条件Exclude> 要素が include 要素よりも優先されるため<、すべての *.docx*.xlsおよび *.ppt ファイルは<移行されません。>

<?xml version="1.0" encoding="UTF-8"?>
<migration urlid="http://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>

構成 XML ファイルを作成する

ファイルを Config.xml 作成および変更して、移行からコンポーネントを除外できます。 移行規則と構文に精通している必要がないため、このファイルを使用したコンポーネントの除外は、移行 .xml ファイルを変更するよりも簡単です。 Config.xmlは、ScanState ツールでコマンド ライン オプションを/genconfig使用して作成できる省略可能なファイルです。 たとえば、ファイルを Config.xml 使用して、既定のアプリケーションの 1 つの設定を除外できます。 さらに、このファイルの作成と変更は、Windows を実行しているコンピューターに移行されるオペレーティング システム設定を除外する唯一の方法です。

  • 既定のアプリケーションの設定を除外するには:ファイルの [アプリケーション] セクションでアプリケーション<>Config.xml指定migrate="no"します。

  • オペレーティング システム設定を除外するには:[WindowsComponents] セクションの<設定に> を指定migrate="no"します。

  • Documents フォルダーを除外するには:[ドキュメント] セクションの [ドキュメント] フォルダーに <> を指定migrate="no"します。 .xml ファイル内のすべての<インクルード> ルールは引き続き適用されます。 たとえば、Documents フォルダー内のすべての .docx ファイルを含むルールが存在する場合、.docx ファイルは引き続き移行されます。 ただし、 .docx されていない追加のファイルは移行されません。

詳細については、「 Config.xml ファイル」を参照してください。

ファイルから Config.xml コンポーネントを除外するには、 移行 値を "いいえ" に設定します。 コンポーネントの XML タグをファイルから Config.xml 削除しても、そのコンポーネントは移行から除外されません。