SOLVED: Step By Step USMT Script To Migrate as Single User On Windows 10

If you are replacing your Windows 10 hardware or just moving a user from one PC to another you can use User State Migration Tool (USMT).

  1. Download the latest Deployment Kit USMT directly from Microsoft
  2. Install the ADK
  3. Copy the USMT folder to a network share of your choosing.  USMT is extracted by the ADK install into C:\Program Files (x86)\Windows Kits\<#>\Assessment and Deployment Kit\User State Migration Tool
  4. Copy the following into a new file you name USMT-BACKUP.CMD file on the network
    @TITLE USMT BACKUP SPECIFIC USER TO LAN
    @echo off
    @set /p varuser=”Enter the name user you want to BACKUP:  (like imatthews) :” %=%net use z:  <UNC path to your USMT network folder>\usmt
    z:
    scanstate.exe z:\store /ue:*\* /ui:na\%varuser% /O /v:13 /i:MigUser.xml /i:MigApp.xmlnet use z: /delete /Y
    pause
  5. Copy the following into a new file you name USMT-RESTORE.CMD file on the network
    @TITLE USMT RESTORE SPECIFIC USER FROM LAN
    @echo offset /p varuser=”Enter the name user you want to RESTORE:  (like imatthews) :” %=%
    net use z: <UNC path to your USMT network folder>\usmt
    z:loadstate.exe z:\store /v:13 /ue:\ /ui:na\%varuser%net use z: /delete /Y
    pause
  6. Go to your source computer (the one you want to move the users files and settings FROM) and right click on your USMT-BACKUP.CMD file and select RUN AS ADMINISTRATOR.  After you have entered Domain Admin credentials, type the username of the user your want to copy and press the ENTER key.  This will kick off the backup.
  7. When the USMT backup is complete, go to your destination computer and (the one you want to move your users files and settings TO) and right click on your USMT-RESTORE.CMD file and select RUN AS ADMINISTRATOR.   After you have entered Domain Admin credentials, type the username of the user your want to copy and press the ENTER key.  This will kick off the restore.

At step 6 you should find a large file named USMT.MIG in <UNC path to your USMT network folder>\usmt\store\USMT\ .  You can also extract the files in that compressed .MIG file with the following command:

usmtutils /extract  <UNC path to your USMT network folder>\usmt\store\USMT\usmt.mig C:\ExtractedStore

Note that USMTUTILS is in C:\Program Files (x86)\Windows Kits\<#>\Assessment and Deployment Kit\User State Migration Tools

If you have any questions, you will likely find the following links useful:

View Comments

  • some updates to the script to make it run a little nicer, and support both 32 and 64 bit systems:

    - Since the current USMT has amdx64 and x86 versions, it'll select the right one based on the system you're running it from.
    - Use the %userdomain% variable to make life easier.
    - It also runs from relative paths as opposed to mapping a z:\ drive.
    - Implemented the check profile change Michael Brown posted, too.

    Place the two batch files in a folder next to the amd64/arm64/x86 folders that USMT provides.

    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: USMT-BACKUP.CMD
    :: https://www.urtech.ca/2016/12/solved-step-by-step-usmt-script-to-migrate-as-single-user-on-windows-10/
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    pushd "%~dp0"
    setlocal enabledelayedexpansion
    IF EXIST "%SystemRoot%\Sysnative\msiexec.exe" (set "SystemPath=%SystemRoot%\Sysnative") ELSE (set "SystemPath=%SystemRoot%\System32")
    set "path=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"

    :startscript
    cls
    @echo off
    echo _______________________________________
    echo Type the username you'd like to migrate
    echo _______________________________________
    @set /p varuser=

    :CheckProfile
    IF EXIST "C:\Users\%varuser%" (GOTO Bitnesscheck)
    @ECHO.
    @ECHO PROFILE DOES NOT EXIST. PLEASE ENTER CORRECT USERNAME. @ECHO.
    pause
    GOTO startscript

    :Bitnesscheck
    "%SystemPath%\reg.exe" Query "HKLM\Hardware\Description\System\CentralProcessor\0" | "%SystemPath%\find.exe" /i "x86" > NUL && set OS=32BIT || set OS=64BIT
    if %OS%==32BIT goto usmtx86
    if %OS%==64BIT goto usmtx64

    :usmtx86
    cd x86
    goto backupprofile

    :usmtx64
    cd amd64
    goto backupprofile

    :backupprofile
    scanstate.exe store\%varuser% /ue:*\* /ui:%userdomain%\%varuser% /O /v:13 /i:MigUser.xml /i:MigApp.xml
    timeout 5 >nul

    :moveprofile
    "%SystemPath%\reg.exe" Query "HKLM\Hardware\Description\System\CentralProcessor\0" | "%SystemPath%\find.exe" /i "x86" > NUL && set OS=32BIT || set OS=64BIT
    if %OS%==32BIT goto movex86
    if %OS%==64BIT goto movex64

    :movex86
    move x86\store\%varuser% %varuser%
    goto eof

    :movex64
    move amd64\store\%varuser% %varuser%
    goto eof

    :eof
    endlocal
    popd

    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: USMT-RESTORE.CMD
    :: https://www.urtech.ca/2016/12/solved-step-by-step-usmt-script-to-migrate-as-single-user-on-windows-10/
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    pushd "%~dp0"
    setlocal enabledelayedexpansion
    IF EXIST "%SystemRoot%\Sysnative\msiexec.exe" (set "SystemPath=%SystemRoot%\Sysnative") ELSE (set "SystemPath=%SystemRoot%\System32")
    set "path=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\"

    :startscript
    cls
    @echo off
    echo _______________________________________
    echo Type the username you'd like to migrate
    echo _______________________________________
    @set /p varuser=

    :moveprofile
    "%SystemPath%\reg.exe" Query "HKLM\Hardware\Description\System\CentralProcessor\0" | "%SystemPath%\find.exe" /i "x86" > NUL && set OS=32BIT || set OS=64BIT
    if %OS%==32BIT goto movex86
    if %OS%==64BIT goto movex64

    :movex86
    move %varuser% x86\store\%varuser%
    goto bitnesscheck

    :movex64
    move %varuser% amd64\store\%varuser%
    goto bitnesscheck

    :bitnesscheck
    "%SystemPath%\reg.exe" Query "HKLM\Hardware\Description\System\CentralProcessor\0" | "%SystemPath%\find.exe" /i "x86" > NUL && set OS=32BIT || set OS=64BIT
    if %OS%==32BIT goto usmtx86
    if %OS%==64BIT goto usmtx64

    :usmtx86
    cd x86
    goto restoreprofile

    :usmtx64
    cd amd64
    goto restoreprofile

    :restoreprofile
    loadstate.exe store\%varuser% /v:13 /ue:\ /ui:%userdomain%\%varuser%
    pause

    :eof
    endlocal
    popd

  • Hi
    Thank you for your comments on my USMTGUI and UPC :-)

    USMTGUI and User Profile Center has just been updated to Windows 10 1803 and we did a big effort this time, rebuilding the interfaces and adding updated and customized XML files.

    We even built an "Afterburner" for USMT, handling Windows 10 Modern apps like Sticky Notes and Edge favorites.
    Usmt Afterburner is fully integrated into USMTGUI and UPC.

    See more at http://www.ehlertech.com or http://www.usmtgui.com

    /Sam

    • No offense but this product is a commercial product and for secured environments we are not allowed to purchase it because he's in a foreign country so rules do not allow it. We should all be paid for our work but if you are going to sell it please provide a commercial version.

  • Hi
    USMT is great but hard to use
    We are with great success using Ehlertech's st. alone GUI for USMT and their Corporate User Profile Central software at our support center.
    Gina

  • Just wanted to say thanks! We like being able to use USMT this way through a batch file. I do have one suggestion. One of our techs mistyped a username when doing a backup and didn't catch it until he tried to restore it. We added an IF EXIST check to force them to re-enter the username if they mistyped it.

    :CheckProfile
    IF EXIST C:\Users\%varuser% (GOTO BACKUPPROFILE)
    @ECHO.
    @ECHO PROFILE DOES NOT EXIST. PLEASE ENTER CORRECT USERNAME. @ECHO.

    pause
    GOTO SelectVaruser

This website uses cookies.