Data Migration Tool: USMT GUI backup/restore tool using the PowerShell App Deploy Toolkit

“Ohh damn, I need to re-create my Explorer favorites, I need to re-enter my wireless profiles..”

Those are some of the comments you will hear from users receiving a new machine in a Service Desk function. Don’t worry, this tool includes it all, and will work when migrating from Windows 7 to Windows 10 as well!

Users will be able to migrate data them self by running this tool from Software Center.

In many cases, enterprises dosen’t offer an easy solution when it comes to migrating data from one machine to another. The best free tool i have come across is the User State Migration Tool (USMT) which is included in the Windows ADK. Sadly this solution is a command-line tool, and dosen’t offer an GUI. Then i came up with a solution. By combining PowerShell App Deployment Toolkit(PSADT) with USMT I made it easy to make this accomplishment. Be aware that this tool requires local administrative privileges for the end user, or making a package running as the local system account on the client PC.

If there is an external USB storage connected, the user gets the option to backup/restore to that location or the network location.

So what does the Data Migration Tool consist of?

The tool consist of a script installer “Deploy-DataMigrationTool.ps1” and a folder containing the installation files. Basically the installer will copy the files to “C:\Program Files (x86)\Data Migration Tool” and log to “C:\Windows\Logs\Software”. It will also create a shortcut in start “C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Data Migration Tool.lnk”.

There is two ways of deploying this tool with SCCM:

Options:

  1. Package (running as local system): Choose this if the users have standard rights on the local machine.
  2. Application (requires local administrator previledges): This will make the application available as a local application with a shortcut in start. Requires that the user to be a local admin.

Before you begin deploying and testing

First we need to configure a network share for the use of this setup. In the example below i use a share for the backups called USMT Data Migration Tool$.

Folder rights if using option 1

Set the share rights on the network folder so that only Domian Computers have modify share access:

Set the NTFS permissions so only Domain Computers modify rights:

Folder rights if using option 2

Set the share rights on the network folder so that only Domian Users have modify share access:

Set the NTFS permissions so that Domain Users have write access to This folder only and CREATOR OWNER have Modify rights to Subfolders and files only:

Before you test and deploy the tool, change the $NetworkLocation variable in the “.\Data Migration Tool\Deploy-Application.ps1” file.

Also I recommend that you read the USMT documentation in case you want to exclude file types or folders.
The policies are defined in the USMT XML files, which are located in “.\Data Migration Tool\Files” and is named:
  • MigUser.xml
  • MigDocs.xml
  • MigApp.xml

Deploying using option 1

If you are in an environment where users are not local administrators, the best solution is to run this as a package in system context. Below i describe how this can be archived. Be aware that this solution will give every system(computer object) account access to all folders in the share. There is no way to overcome this unless you want the user to type in the hostname of the PC that performed the backup. One could setup a cleanup script on the server hosting the share, to delete backups older than 14 days.

  1. Create a package with the files from the “Data Migration Tool” subfolder.
  2. Deploy the package to distribution points.
  3. Create a Program with “Deploy-application.exe” in the Command line textbox.
  4. Ensure that the environment is set as shown in the picture:
  5. Create a available deployment for a user or device collection and test the setup.

Deploying using option 2

This option allows the users with local administrative rights to have a local application installed with a shortcut in start.

  1. Create an applicaiton with all the content of the zipped folder “Data-Migration-Tool-<version>”
  2. Setup the Deployment Type program with the following install/uninstall commandline:
    Install:powershell.exe -ExecutionPolicy Bypass -file .\Deploy-DataMigrationTool.ps1
    Uninstall:powershell.exe -ExecutionPolicy Bypass -file .\Deploy-DataMigrationTool.ps1 -uninstall
  3. Define the Detection Rule:
  4. Configure the User Experiene to install as system:
  5. Deploy the application to a user or device collection and update policies, go to software center and install:

Known errors

  • Recieving the USMT error 71 means that you have done something wrong with the folder permissions.
  • Recieving the USMT error 37, don’t run this tool on a server you fool 😉

Changes

1.12

-Removed the Convert-FromString function from the Export-WLANProfiles function in the AppDeployToolkitExtensions.ps1 as it was dependent on PowerShell version >= 5.0.

-Added a check to only export WLAN profiles when running on a psysical machine.

1.11:

-Removed the parameter -NoAppSettings switch from the Start-UserStateMigrationTool function call in the Deploy-Application.ps1 script.
-Removed the custom XML from the command line string in the 
Start-UserStateMigrationTool function located in the AppDeployToolkitExtensions.ps1

1.1:
-Changed the current user variable to be the current user session instead of running context. Was an issue if running as system.

1.0

Version Download

Data Migration Tool 1.12

Data Migration Tool 1.11

I would very much like to improve this tool, so please share ideas!

8 thoughts on “Data Migration Tool: USMT GUI backup/restore tool using the PowerShell App Deploy Toolkit”

  1. Hello,
    First of all, great tools.
    I tested it locally with admin rights, but it comes out with error 71 or 28.
    After analysis of the log it uses a CustomMig.xml file that is not present in the package.
    Is this an oversight?
    Thank you in advance for your answer
    Cyrille

    • Hi Cyrille,
      Thanks for your feedback, you’re right about the oversight. I had some custom stuff in my own XML file i used for testing. It’s now correct and should work in the new v.1.11.
      /Morten

  2. The WLAN profile functions are not working on a virtual WIN7 test box. The “$WLANProfiles = netsh.exe wlan show profiles |`” in AppDeployToolkitExtensions.ps1 returns “The wireless AutoConfig Service is not running” and the script is looking for “All User Profile”. Even with the service running is fails as there is no wireless interface.

    • Hi Mike,
      Thanks for the heads up, i’ll add a check for virtual machine and skip the WLAN profile migration in the next release.

    • Hi,
      The user who took the backup will be presented with a restore button when running on a new system.
      The script will basically check if there is a backup available in line 175 of the script:
      if(Test-Path “$Location\$Profile\USMT\USMT.MIG”){
      Write-Log “Old backup detected..”
      $BackupInfo = Get-ChildItem “$Location\$profile\USMT\USMT.MIG”
      $BackupAge = $BackupInfo.LastWriteTime.ToString(“yyyy-MM-dd HH:mm”)
      $BackupGBSize =[Math]::Round((($BackupInfo | Measure-Object -Property length -sum).sum /1GB),3)
      }
      Hope that helps
      EDIT: You can test if you run a successfull backup on a machine, and run the tool again, you’ll se the restore button is present.

  3. Hi ,
    Thanks for the great tool.
    While trying to execute it in our SCCM Test lab, we are getting the below error.
    1. Created a package and used deploy application.exe as the command line, deployed it to a device collection.
    2. Got the initial screen, once clicked on backup, getting the below error, i guess the issue might be due the test machine being a VM.
    3. Error mssg:

    Error Record:

    Message : the term “Convertfrom-string” is not recognised as the name of a cmdlet,fnction,script file or operable program.Check the spelling of the name or if a path was included, verify that the path is correct and try again.

    Inner exception:
    FullyQualifiedErrorId:CommandNotFOundException
    ScritpStackTrace:at Export-WLANProfiles,C:\windows…..AppDeployToolkitExtenstion.ps1: line 128 at ,

    C:\windows….deploy-applications.ps1 line 222

    4. Tried to comment the WLAN script block, then we got the error as “execution failed with exit code 71.”

    Pls let us know how to fix this issue.

    • Hi Sameer,

      I have uploaded a new version (1.12) that should fix the error with the WLAN function.

      The error 71 you recieve is due to lack of permissions on the share. Please read section “Before you begin deploying and testing” again as i have updated that section to ensure that correct rights has ben setup on the share.

      Let me know if that helps, or the issue persist

      /Morten

Leave a comment