Tuesday, December 17, 2013

USMT Wrapper Script


During a hardware refresh there are times that data migration needs to be done manually such as with software encryption or other reasons. With the granularity that USMT supports, Scott and I wrote a wrapper script to do all the work for the techs as there is just too much flexibility!

For distribution, we have it as a package within ConfigMgr that can be downloaded by techs using the package down loader tool (see previous post). This way they always have the latest version of the script and XML files used by USMT. You call the script on the old computer with the new computer as a command line switch:


First thing it does is copy it locally to %WINDIR%\TEMP as the USMT commands can be impacted by the DOS 256 character command line limit. Why a DOS Script? XP, don't have to worry about PowerShell being present as DOS has been around for a little longer...

If you do not pass it the new machine, then it will ask you for the new computer name. It uses SED for this which you put in the x86 and/or amd64 folders.

When ran from the old system, it will create C$\USMTStore on the new system and start migrating data with ScanState to a MIG file there.

Once complete you run the wrapper on the new machine and it will do a restore via LoadState.

Other things that the script does.
  • Detects XP and copies manifest files to %WINDIR%\system32\DLManifests
  • Runs correct architecture version of scanstate and loadstate for 32-Bit or 64-Bit
  • Copies the logs to the ConfigMgr logs folder (%WINDIR%\CCM\Logs) for cleanliness
  • Captures start and stop times


The wrapper is set up for my environment so you will have to parse it and change things accordingly. Specifically you will have to do something about the IncludeExclude.XML as this is custom for our environment, or just rename one of yours to it. There are several REM statements and comments that do different things. If you do not use ConfigMgr then you will need to modify the log copy at the end.  Since its all done with variables several of them can be set before running the script such as destination as a side note.

If you make any changes please let me know as I may add it upstream!


This script is provided as-is, no warranty is provided or implied.The author is NOT responsible for any damages or data loss that may occur through the use of this script.  Always test, test, test before rolling anything into a production environment.

I am providing both USMT4 and USMT5 versions however they can be interchanged with little modification. We'll make a USMT6 version soon.


GUI for it? This was for USMT4 and Scott is talking of making a new one for USMT5 (or 6). It lets you choose profiles and files/folders to customize.


  1. there is a small glitch in the line:
    if #ERRORLEVEL% == 1 Echo XP not found

    I suppose it must be:
    if %ERRORLEVEL% == 1 Echo XP not found

    very good script :)