Datasheet
Designing User State Migration
19
The /e switch specifies that all directories should be copied—even empty ones. The /v
switch is used to verify the files, and the
/y switch is used to suppress prompting if any files
are overwritten.
Chapter 3 covers the XCopy command and other elements of the command
prompt in more depth.
Unfortunately, this works only if the USB flash drive is assigned the letter D:. It could be
assigned other letters such as E:, F:, and so on. You can add multiple lines to your batch file
to check for which letter is actually assigned to the USB flash drive. Simply copy and paste
the following line, changing only the letter of the drive:
If exist E:\USMT\*.* XCopy /e /v /y C:\Windows\USMT\
If exist F:\USMT\*.* XCopy /e /v /y C:\Windows\USMT\
Once you have added the extra lines, the rest of the batch file becomes a little easier.
You now know your USMT files exist in the
C:\Windows\USMT\x86 and the C:\Windows\
USMT\AMD64
folders. You simply change to the appropriate directory and run the ScanState
and
LoadState commands.
For example, if you were migrating data to a 32-bit installation of Windows 7, you’d use
the following batch file shown in Listing 1.1.
Listing 1.1: Batch file for 32-bit data migration
If exist D:\USMT\*.* XCopy /e /v /y C:\Windows\USMT\
If exist E:\USMT\*.* XCopy /e /v /y C:\Windows\USMT\
If exist F:\USMT\*.* XCopy /e /v /y C:\Windows\USMT\
If exist G:\USMT\*.* XCopy /e /v /y C:\Windows\USMT\
If exist H:\USMT\*.* XCopy /e /v /y C:\Windows\USMT\
If exist I:\USMT\*.* XCopy /e /v /y C:\Windows\USMT\
rem
Cd
“c:\Windows\USMT\x86”
ScanState.exe c:\store /v:13 /o /c /hardlink /nocompress /efs:hardlink
/i:MigApp.xml /i:MigDocs.xml /offlineWinDir:c:\windows.old\windows
LoadState.exe c:\store /v:13 /c /lac:P@ssw0rd /lae /i:MigApp.xml
/i:MigDocs.xml /sf /hardlink /nocompress
This batch file checks to see if the USB drive has been assigned letters D: through I:, but
if you want to check for all possible drive letters just copy an
If exist line, paste it, and
modify the letter in the new line. You can check for all drive letters up to Z: if desired.
You could save this file as
usmt32.bat.
However, if you needed to run the migration on a 64-bit system, you could replace
x86
with
amd64 in the change directory line and save the file as usmt64.bat.
Cd “c:\Windows\USMT\amd64”
597095c01.indd 19 6/2/10 4:12:57 PM