James Bannan20 July 2007, 1:37 AM
Customising Windows from scratch can be infinitely time-consuming and tedious. Here's a way to not only streamline the whole process, but to keep user accounts on different PCs in complete sync.
Everyone knows that they should always back up their system. Occasionally, some people even remember to do it. And then the system fails or something corrupts and you have to rebuild, and even though you’ve got a backup, the one thing you don’t have is a backup of your user profile.
As you use and customise a computer over time, all those personal choices are stored in your local profile. And it’s not just which wallpaper you like – internet favourites and loads of third-party application settings are stored as well. Losing these doesn’t just mean re-customising the desktop, it means re-customising every application you’ve ever installed.
Luckily, Vista has made life much easier with the Easy Transfer Wizard, which does actually do a great job at transferring all user information to another machine. However it does have two small inconveniences – first, the destination machine has to have Vista installed, and second, the wizard is a little cumbersome. If you have Vista it’s available in the Start Menu (Start, All Programs, Accessories, System Tools), but if you’re running Windows XP you have to launch it from a Vista DVD or download the Easy Transfer Companion. Whichever method you choose, it’s still a one-off process – the implication is that you’re using the wizard to migrate settings, rather than simply back them up.
There is a much better method. Easy Transfer is based on Microsoft’s User State Migration Tool (USMT), which is a flexible, XML-driven application used mostly by system admins, OEMs and developers. USMT has none of the limitations of Easy Transfer (which is essentially just a user-friendly implementation of USMT). It can transfer from and to both Windows XP SP2 and Windows Vista (32-bit and 64-bit versions of both operating systems).
Using USMT also means that you can set up an automated scheduled backup of your profile's settings. This means that you have a backup in case of system failure, and if you have secondary machines which you’d like to have the same profile information, you can even keep multiple machines in perfect sync.
Using USMT
The first thing you’ll need is to download and install USMT. The current version is 3.1, and is available for both 32-bit and 64-bit platforms. It doesn’t support any of the Windows server operating system or any of the Starter editions of Windows XP or Vista.
USMT |
USMT is a command-line driven application, so initially you’ll need to open a command window and navigate to C:\Program Files\USMT301. If you’re running Windows XP, you have to be logged into an account which is a member of the Administrators group. If you’re running Windows Vista, you have to open the command window with admin rights. To do this, go Start, All Programs, Accessories. Right-click Command Window and select “Run as administrator”.
The tool for scanning and backing up settings is ScanState.exe. The correct syntax depends on what you’re scanning and where it will be restored to. The basic syntax for migrating settings between Windows XP machines is:
scanstate \\fileserver\share\mystore /targetxp /i:migsys.xml /i:migapp.xml /i:miguser.xml /v:13
While the default syntax for a Windows Vista-based transfer is:
scanstate \\fileserver\share\mystore /i:migapp.xml /i:miguser.xml /v:13
The main differences between the two are that the XP transfer requires the /targetxp switch, and it also uses the migsys.xml file while the Vista-based one does not. The XML files handle different parts of the migration process, and can be customised or excluded as you prefer. When the destination is a Vista machine, manifests are used rather than the migsys.xml files. Manifests cannot be modified, so any customisations you want on a Vista-based backup has to be done via a custom.xml file.
For more detailed information on the migration XML files, read this page.
The backup does not have to be a networked folder. It can be a secondary hard drive, flash drive or whatever you like. The only two requirements are than it cannot be on C:, and if it is a networked location, the current logged-on user has to be able to access it without entering a password.
You don’t have to specify a network folder with UNC either – it can be a mapped drive. Also, if the backup location uses a folder with a space (like D:\My Backups), enclose the path in quotation marks (“D:\My Backups”).
Try the scanstate command – the process will take at least a couple of minutes, but will take longer depending on how many applications you are backing up and how much personal data is stored within the profile. Bear in mind that if your Documents folder has 2GB of data, then the backup will be at least 2GB. If you store your data in a non-profile folder, like C:\MyData, then by default USMT won’t back it up. There is a way to include non-standard folders, which is outlined here.
Automating the Process
Take a look in the backup folder specified. You should now have a subfolder called USMT3, and within that a file called USMT3.MIG. That contains all the migration data. The next step is to create a scheduled task which does an automatic backup, rather than having to use the command window every time.
Scheduling an automatic backup in Windows XP
Go to Start, Programs, Accessories, System Tools, Scheduled Tasks, and double-click Add Scheduled Task.
USMT - XP Schedule |
Click Next, and then Browse to C:\Program Files\USMT301\ScanState.exe. Choose a Schedule and click Next. Enter the username and password of an account with admin rights and click Next. Tick the “Open advanced properties” button and click Finish.
Go to the Run field, and after “C:\Program Files\USMT301\ScanState.exe”, type in the rest of the scanstate syntax after the last quotation mark, so that it reads:
"C:\Program Files\USMT301\ScanState.exe" "\\fileserver\share\mystore" /o /targetxp /i:migsys.xml /i:migapp.xml /i:miguser.xml /v:13
USMT - Task Properties |
You need to add a new argument to the string - /o. This forces an overwrite when there is existing data. If you don’t use this argument the backup will fail. Click OK and you’re done. Right-click the newly-created task and select Run to test it.
Scheduling an automatic backup in Windows Vista
Go to Start, All Programs, Accessories, System Tools, Task Scheduler. In the Actions pane, click “Create Basic Task”. Call it something like “Profile Backup” and click Next.
USMT - Vista Schedule |
Then, choose a schedule which suits you. As the backup task can take a while, you probably don’t want it to run when the computer starts or on logon – it will create a lot of unnecessary overhead. Bear in mind that regardless of any schedule you pick, the task can be run manually at any time.
USMT - Vista Schedule Event |
When you get to the Action window, choose “Start a program” and click Next. In the Program/Script field, click Browse and select C:\Program Files\USMT301\ScanState.exe. In the “Add arguments” field type in the rest of the ScanState syntax. Click Next, then tick “Open the properties” and click Finish, and the newly-created task properties window opens up.
USMT - Vista Schedule Properties |
In the General tab, tick “Run with highest privileges” – you need to do this as the application won’t be running from an administrative command window. You can also tick the “Hidden” checkbox if you don’t want the command prompt to pop up on screen (which it will). Click OK and you’re done. Now click on Task Scheduler Library in the left-hand pane and the new task will be there. Highlight it and select Run to test it out. It’s worthwhile not using the Hidden feature until you’ve made sure it works.
Restoring The Data
If you’ve used the migapp.xml file in the backup process, you need to have pre-installed all the applications which you want to restore settings for. As with all backup utilities, USMT can’t back up applications file, only settings.
Restoring to Windows XP
To restore the backup, you need to use the LoadState.exe command. Again, you need to be logged on as user with administrative rights. The syntax is pretty much the reverse of the scanstate command:
loadstate \\fileserver\share\mystore /i:migsys.xml /i:migapp.xml /i:miguser.xml /v:13
You don’t need the /targetxp switch, but you do need to be restoring data which was made using that switch.
USMT - XP Restore |
Explorer.exe unloads as the settings are applied, and then reloaded once it’s done – no reboot necessary.
Windows Vista
Restoring the data in Windows Vista is basically the same as Windows XP, just with slightly modified syntax:
loadstate \\fileserver\share\mystore /i:migapp.xml /i:miguser.xml /v:13
However, because Vista has the Easy Transfer Wizard installed, it recognises the .MIG file as a USMT migration store file. Simply double-click the file and Vista launches the Transfer component of the Easy Transfer Wizard. It will look at the user profile(s) contained in the migration store and will prompt for the corresponding local account.
USMT - Vista Users |
If the accounts are the same, then user passwords are also migrated. Click Next and then Transfer, and the settings are restored.
USMT - Vista Restore |
As Vista restores a lot more information than XP, a restart is necessary.
And that’s pretty much it. If you want to keep a secondary system in sync with your primary machine, create a scheduled task on the second machine to run LoadState.exe shortly after the primary system has run ScanState. Alternatively, write the LoadState.exe command to a batch file and launch it manually.
USMT is a highly flexible tool, and there are loads of options in both scanstate and loadstate to allow you back up extra folder, exclude others, focus on particular file types and create your own custom XML scripts. Microsoft has thoroughly documented USMT on TechNet, and there’s a flourishing online discussion forum too.