blog

Use Windows Easy Transfer To Automate User Backups

Windows-Easy-TransferI’m always looking for interesting challenges, and this one is no different. I came across this question in Microsoft’s Answers forum and I was intrigued. Windows Easy Transfer is actually pretty good for migrating user accounts and pulling out settings, but what if you wanted to use this tool to attempt a full user profile backup (to disk) at regular intervals? Is it even possible in any reliable way to do this?

Summary: I try to find a way to schedule a  user profile archive using Windows Easy Transfer in an automated way.

Attempt #1 – Command Line
In the various flavours of Windows, you find the Easy Transfer tool in these locations (based on 32 bit):

Windows XP: %programfiles%\Microsoft\MigWiz\migwiz.exe (download) (Vista)
Windows 7:  %SystemRoot%\system32\migwiz.exe (Factory installed)

The use of this tool is by a wizard only and there are no command line parameters (that I could see). I think administrators would welcome the ability to automate the use of this tool using the command line for a number of reasons including backups and archiving user’s profiles while the user exits a company. The power of a real and useful profile management tool has always been lacking in Windows.

Attempt #2 – Using a Macro Tool, AutoHotKey
The second time around called for some wizardry with a macro tool. The one I decided to try out in this case was the Open Source tool named AutoHotKey. This tool allows you to launch and send commands to programs for the purpose of automating processes. Perfect for Windows Easy Transfer.

To see how this turns out, take a couple minutes and look at how the scheduled task looks when it’s launched (full screen suggested). At the end of the video, I show you the program and the scheduled task.

So, how was this done (Based on Windows XP x32)?

#1. Install AutoHotKey and say yes to getting the sample script installed. Also, depending on your Operating System, make sure you’ve installed the newest version of Windows Easy Transfer.
#2. Take some time yourself to look at the simple. In my case I just modified the sample crudely and changed the code to this:

Run C:\PROGRA~1\MICROS~2\MigWiz\migwiz.exe


WinWait, Windows Easy Transfer, , 3
if ErrorLevel
{
    MsgBox, WinWait timed out.
    return
}
else
    Click 864, 614
    Sleep, 1000
    Click 287, 389 ;USB
    Sleep, 1000
    Click 367, 395 ;External Disk
    Sleep, 1000
    Click 867, 620 ;Next on filename
    Sleep, 1000
    Click 369, 170 ;Overwrite
    Sleep, 1000
    Click 335, 350 ;My Account
    Sleep, 30000
    Click 840, 622 ; Transfer
    Sleep, 30000
    Click 840, 622  ; Close

#3. With the above code, make sure you know what it’s doing and perhaps tweak it to your situation. One of the biggest changes I would suggest is finding a way to avoid using the SLEEP command by detecting visual elements (and making the execution more flexible). There’s allot of work to do there, but this is a start.

#4. Right-Click on your finished script and click on “Compile Script” to create and .exe file

Windows-Easy-Transfer-1

#5. Open the Task Scheduler and created a task that will ruin the above application when you require. I would suggest an interval of a week at most (depending on the size of a user’s profile).

You’ll want to continue to task and iterate this until it works exactly how you want it too. I can see it also running, building a date string and changing the file name to whatever the date is, for multiple backups. You can take the script and build on it and add features. If you do decide to attempt this, please do pass on any improvements you make in the comments.