One of the most popular tools to migrate user profiles from one Windows computer to another is the set of CLI utilities — User State Migration Tool (USMT), which is a part of the Windows Assessment and Deployment Kit. USMT tool allows you to automate and simplify the process of migrating the users’ environment and profiles while deploying Windows, migrating users between different Active Directory domains, and in other cases.
The transfer of user’s data takes place in two steps, one of which takes place on the old one and the other one on the new computer. USMT can migrate operating system settings, applications, and even access control lists (ACLs). This means that the user’s access permissions on the target computer will be the same as they were on the source system.
Hint. USMT migrates application settings but does not migrate the applications themselves. For applications to work correctly, you will have to install them on the target computer.
Migrating User Profiles Using USMT
The latest currently available version of USMT 10 allows you to migrate user’s settings and profiles and apply settings from operating systems starting from Windows 7 and up to Windows 10. The important difference from the previous version of this utility is the ability to collect the settings in the Offline mode (not while running the operating system). If you want to use USMT on legacy systems (Windows XP, Windows Vista), then you must use version USMT 3.0.1.
You can download the ADK for Windows 10 here.
To install ADK on your admin’s workstation or the source computer, run adksetup.exe file and select User State Migration Tool (USMT) to install:
After the installation is complete, you can find the USMT files in the directory C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\User State Migration Tool (later you can copy these files to the source computer).
This utility consists of two command-line programs scanstate.exe and loadstate.exe, as well as a set of XML files describing the process of collecting and applying settings.
Both tools must be run under an account with local administrator permissions.
Data transfer using USMT can be performed in two steps: exporting data from the source computer using the ScanState command and importing data on the target computer using the LoadState.
Hint. A separate tool EnbUSMTUtils.exe is used to remove the local migration store.
USMT allows you to write data to a local disk, removable USB drive, or a shared network folder, but cannot transfer data across the network directly from the source to the target computer.
Saving a User Profile with USMT
The first step of the transfer takes place on the source (old) computer. To collect the user’s data, the scanstate command is used.
Scanstate.exe scans the computer according to the specified requirements, creates a repository, and collects users’ profiles and accounts, application and OS settings, files, registry keys, and other data.
Note. From Windows 10 1607, USMT can’t migrate the start menu layout. Instead, you must use Export-StartLayout and Import-StartLayout PowerShell cmdlets.
The USMT utility creates 4 migration files (in .XML format) that store rules for migrating various kinds of data:
- MigApp.xml — contains rules for transferring users’ data;
- MigUser.xml — contains rules for transferring users’ profiles;
- MigDocs.xml — document transfer rules;
- Config.xml — covers information on the components that are excluded from the transfer.
To migrate all accounts and user settings from one computer to another, run the command:
scanstate \\fs1\migr\userdata /i:miguser.xml /i:migapp.xml /o
The following data in the user profile is migrated by default:
- Standard directories from the user’s profile: Documents, Video, Music, Pictures, Desktop, Start menu, Quick Launch settings, Favorites;
- File types: accdb, .ch3, .csv, .dif, .doc*, .dot*, .dqy, .iqy, .mcw, .mdb*, .mpp, .one*, .oqy, .or6, .pot*, .ppa, .pps*, .ppt*, .pre, .pst, .pub, .qdf, .qel, .qph, .qsd, .rqy, .rtf, .scd, .sh3, .slk, .txt, .vl*, .vsd, .wk*, .wpd, .wps, .wq1, .wri, .xl*, .xla, .xlb, .xls*.
By default, all users’ profiles on a computer are migrated. You can specify which users to migrate using the include and exclude options.
To migrate only two user accounts from one computer to another:
scanstate \\fs1\migr\userdata /ue:** /ui:corpuser1 /ui:corpuser2 /i:miguser.xml /i:migapp.xml /o
You can only migrate users who have recently logged into the computer. For example, you can specify that only users who have logged into this computer within the last 50 days should be migrated. For this, the /uel:50 option is used. User profiles are selected by the Last Modified date of the Ntuser.dat files in the user directories under the C:\Users folder.
Or you can exclude certain accounts from migration:
You can exclude all domain users’ profiles:
Or just local ones:
Scanstate supports the use of Volume Shadow Copy Service. This means you can transfer even files that are locked (used) by currently running applications. The /vsc parameter is used for this.
For example, to create an encrypted store (with an encryption key — StR0n51) on a network shared folder using specified configuration files, you can use the following command:
scanstate \\fs1\migr\mystore1 /i:migapp.xml /i:miguser.xml /o /config:config.xml /encrypt /key:"StR0n51"
By default, compression is used when saving profile files. This allows the user to reduce the storage file size, but it takes longer to create the archive. You can disable compression with the /nocompress option.
Also, you can use USMT to perform offline profile migration. Boot your computer into the Windows РЕ environment and run the ScanState to export users’ profile settings.
After creating a store, you can check its integrity with the command:
Another interesting way to use the USMT is to perform a backup of users’ profiles on some critical computers.
Migrating and Deploying a User Profile with USMT
The second step of transferring the user profile is performed on the target (new) computer. To complete the migration, use the loadstate.exe command. The loadstate tool imports (extracts) all store items to the target computer.
To load all profiles on a source computer from the store created earlier, run:
loadstate \\fs1\migr\userdata /i:miguser.xml /i:migapp.xml
Hint. Please note that you should not logon to the computer under a new user before migrating his profile via loadstate.exe. If this user already exists on the computer, then when restoring the profile, the LoadState error return code: 71 will appear. In this case, you need to delete the user’s profile in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList.
If you want to transfer a user’s profile and move a user from one domain to another:
loadstate \\fs1\migr\userdata /mu:/ui:corpuser:/ui:corp2user /i:miguser.xml /i:migapp.xml
Note. When you use the LoadState command to migrate domain users, the computer doesn’t need access to the target or source domain controller to apply user profiles.
With the /md:OldDomain:NewDomain option you can specify a new domain for users. This option is used to change the user’s domain during migration. If the username in the source and destination domain is different, you can match the account names in the old and new domain:
For example, to load user profiles from an encrypted store on a shared network folder run the command:
scanstate \\fs1\migr\mystore1 /i:migapp.xml /i:migapp.xml /i:miguser.xml /decrypt /key:"StR0n51"
The USMT utility easily integrates with SCCM and MDT. It makes it easier and more automated to move users. The administrator only needs to make preliminary settings, and user migration can be done completely automatically.