次の方法で共有


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

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

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

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

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

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

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

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

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

<include> と <exclude>

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

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

例 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\tmp内のファイルとサブフォルダーを除く、C:\Data内のすべてのファイルとサブフォルダーを移行します。

<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:\EngineeringDraftsSample.doc ファイルを除き、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 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:\WindowsC:\Program Filesのシステム フォルダーを無条件に除外します。 <unconditionalExclude> 要素が <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 ファイルの <Applications> セクションでアプリケーションのmigrate="no"を指定します。

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

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

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

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