Thursday, January 30, 2014

USMT sample Examples

Custom XML configuration
For example, perhaps you know users have mp3 files in folders that you might otherwise be migrating. The solution would be to include all files from C:\ except .mp3 files. For example, to get all files excluding mp3 files, you can use the following custom XML configuration file contents:

<migration urlid="http://www.microsoft.com/migration/1.0/m">
    <component type="Documents" context="System">
        <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>

A single data folder or perhaps a folder specific Folder to include in the migration.

<migration urlid="http://www.microsoft.com/migration/1.0/m">

<component type="Documents" context="System">

  <displayName>Component to migrate all ApplicationNameData folder contents on

   any drive on the computer </displayName>

  <role role="Data">

    <rules>

        <include>

           <objectSet>



  <script>MigXmlHelper.GenerateDrivePatterns ("\ApplicationNameData\* [*] ",

  "Fixed")</script>



  <script>MigXmlHelper.GenerateDrivePatterns ("*\ApplicationNameData \* [*] ",

  "Fixed")</script>

      </objectSet>

         </include>

   </rules>

  </role>

</component>

</migration>

For alternate target location 
There may also be files and settings you want to migrate, but you want to specify an alternate target location as part of the transfer process. For example, to migrate all .jpg files and have them restored to a folder named Images on the destination computer, the following XML file contents may be used:

<migration urlid="http://www.microsoft.com/migration/1.0/m">

<component type="Documents" context="System">

  <displayName>All .jpg files to Images</displayName>

  <role role="Data">

    <rules>

      <include>

        <objectSet>

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

  script>

        </objectSet>

      </include>

      <locationModify script="MigXmlHelper.Move('C:\Images')">

        <objectSet>

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

  script>

        </objectSet>

      </locationModify>

    </rules>

  </role>

</component>

</migration>

Working with Config.xml
Config.xml is an optional file you can create by using the /genconfig option of the ScanState tool. If you want to exclude certain elements of a migration, this is the preferred way to do so. This file does not contain any migration rules, just a list of system components, applications, and user documents that may be migrated.
Running the following command on a machine causes the config.xml file to be built containing every component that can be migrated. The components are organized into sections: <Applications>, <WindowsComponents>, and <Documents>. To choose not to migrate a component, simply change its entry to migrate="no" 
To create a Config.xml file in the current directory run the following command (note: this does not create a store, just the Config.xml file):
ScanState /i:migapp.xml /i:miguser.xml /genconfig:config.xml

To make use of this same Config.xml when creating a migration package, run the following command:

ScanState \\server\share\store /i:migapp.xml /i:miguser.xml /o /config:config.xml 

For Config.xml  you can exclude items is to use a Config.xml
If you are aware of a specific area of the registry you would like to migrate, you can specify a subkey, value, or a subkey and its child subkey. To migrate a set of registry keys and its subkeys, the following XML file contents may be used:
<migration urlid="http://www.microsoft.com/migration/1.0/m">
     <component type="Application" context="System">

   <displayName>Component to migrate all ApplicationName HKCU subkeys and values
   </displayName>
          <role role="Settings">
          <rules>
               <include>
                    <objectSet>

   <pattern type="Registry">HKCU\Software\Company\ApplicationName\* [*]</
   pattern>
                    </objectSet>
               </include>
          </rules>
          </role>
     </component>
</migration>


1 comment: