5. Getting Extra Mileage Out of the USMT
This section outlines some tips and tricks you can use to get some extra mileage out of the USMT.
5.1. Modify the MigDocs.xml File to Exclude Files
You can modify the MigDocs.xml file to
exclude any specific types of files based on their extension. You do
this by adding an exclude rule to the file. The exclude rule takes the
following format. In this example, it will exclude all MP3 files but you
can substitute any extension for .mp3:
<exc1ude>
<objectSet>
<pattern type="Fi1e">C:\* [*.mp3]</pattern>
</objectSet>
</exclude>
The following XML text can be used by itself in a different MyMigDocs.xml file to migrate all data files except MP3 files, or you can just place the previous <exclude> node within the existing MigDocs.xml file.
<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="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>
You can find additional examples of how to exclude
files in the "Exclude Files and Settings" article in the User State
Migration Tool (USM) 4.0 User's Guide available in the help file at C:\ Program Files\Windows AIK\Docs\CHMs\USMT.chm.
5.2. Building a USB Drive to Simplify Migrations
It's relatively easy to create a portable USB drive
with the tools you need to perform hard-link migrations on systems that
include the Windows.old folder. You can even include a script
to copy all the needed files, and then complete the migration. All you
have to do is plug in the USB and start the batch file.
First, copy the entire contents of the C:\Program Files\Windows AIK\Tools\USMT\
folder onto the USB drive. These files are on your technician's
computer after installing the WAIK. Next, create a batch file named Migrate32.bat, with the following lines:
©ECHO OFF
If exist D:\USMT\*.* xcopy D:\USMT\*.* /e /v /y C:\Windows\USMT\
If exist E:\USMT\*.* xcopy E:\USMT\*.* /e /v /y C:\Windows\USMT\
If exist F:\USMT\*.* xcopy F:\USMT\*.* /e /v /y C:\Windows\USMT\
If exist G:\USMT\*.* xcopy G:\USMT\*.* /e /v /y C:\Windows\USMT\
If exist H:\USMT\*.* xcopy H:\USMT\*.* /e /v /y C:\Windows\USMT\
If exist I:\USMT\*.* xcopy I:\USMT\*.* /e /v /y C:\Windows\USMT\
If exist J:\USMT\*.* xcopy J:\USMT\*.* /e /v /y C:\Windows\USMT\
If exist K:\USMT\*.* xcopy K:\USMT\*.* /e /v /y C:\Windows\USMT\
Cd c:\windows\usmt\x86
scanstate.exe c:\store /v:5 /o /c /hardlink /nocompress
/efs:hard1ink /i:MigApp.xm1 /i:MigDocs.xm1
off1inewino1d:c:\windows.o1d\windows
1oadstate.exe c:\store /v:5 /c /lac /i:migapp.xm1
/i:migdocs.xm1 /hard1ink /nocompress
The If exist... lines detect which drive is the USB drive and then copy all of the USMT files onto the target computer. The Cd line changes the directory to the usmt\86 folder. The ScanState command captures the user state data, and then the LoadState command applies it.
If your target computer is a 64-bit system, save the file as Migrate64.bat and change the Cd line to:
Cd c:\windows\usmt\amd64
This script is derived from the "Windows XP to
Windows 7 Hard-Link Migration of User Files and Settings" white paper
available from Microsoft's download site (www.microsoft.com/downloads).
5.3. Deleting the Hard-Link Store
If you later need to remove the hard-link store but
get errors indicating that the folder is locked, you can delete it with
the following command:
C:\>c:\usmt\Usmtuti1s /d c:\HardLinkStore
You should only delete the hard-link store once you are sure that you have migrated all the needed data.
5.4. Deleting the Windows.old Folder
The Windows.old folder can take a lot of
space. Once you are done with it, you can delete it to regain space. The
simplest way to delete it is using Disk Cleanup from the properties of
the drive. You can access the properties by right-clicking the drive in
Windows Explorer and selecting Properties. After clicking Disk Cleanup,
click the Cleanup System Files button. The Previous Windows
installation(s) selection will appear and you can then select it to
delete the Windows.old folder.
While this will work, you may want to automate the process. You can use the following two lines in a script file to delete the Windows.old folder. The first line takes ownership of the Windows.old folder and all files and folders within it. The second line removes the folder, including all folders within it.
takeown /f c:\windows.o1d\* /r /a /d Y
rd /s /q c:\Windows.o1d\