Relocating Windows User Data

Quite some time ago I wrote a post about how to relocate the C:\Users and C:\ProgramData directories of a Windows installation to another drive. This is useful for those of us whom want to use a different hard drive for the operating system and keep documents elsewhere. In my case, my OS is installed to a solid state drive that is simply too small to fit all of my documents, music and pictures. I simply needed a better way to store all the data. When I discovered NTFS junctions (aka: reparse points) I realized I could do just that. I could finally put some breathing room between my operating system and my data.

Now that Windows 8 is here (well almost) I realized I was going to need to move all that data over yet again. In previous years, relocating user data was a pain, specifically because of all the reparse points that have to be fixed recreated once the data is copied to the new drive. Making sure you recreate every reparse point can be quite challenging. Moreso, if you miss one it could mean very bad things when you try to boot the system up again. This got me thinking, why not just write a program to do all that dirty work for me? And so I did.

The program is called MoveUserData. It runs at a command prompt and is intended to be used in the Recovery Console (so that security rights are not an issue). Below you will find the program and full source code.

MoveUserData_v1.zip 
MoveUserData_source.zip

Using the program is quite simple. Copy MoveUserData.exe to a USB drive or CD. Boot the Windows installation disc and go into Windows Recovery mode. Choose Command Prompt from the list of recovery options. Once you are at a command prompt put the CD/USB drive containing MoveUserData.exe into the computer.

Assuming that your Windows installation drive (normally C:) is currently listed as K:, your data drive is D: and that the CD/USB drive is set to E: then you can execute the following commands.

The program will do the rest. Once done, just reboot!

Disclaimer: As stated in my previous article, messing around with your operating system like this is very dangerous. While I have made every effort to ensure the program works as described it is still possible that errors will occur. So make sure to back up your drive first. Use of this program is at your own risk.

Update [October 5, 2012]:
So despite my rigorous testing of the program it appears that it doesn’t actually work in the scenario in which I intended, the command prompt of the Windows Preinstall Environment (installer discs). Truth be told I never actually tested it in this scenario because it would have made development incredibly slow and complicated. Instead I tested using a duplicated data set on a separate pair of drives from my main system. Apparently that was a big mistake on my part since it would seem .NET based applications like mine don’t run at all in Windows PE. Bummer!

An aside: Why on earth would Microsoft develop the .NET framework and market it as the end-all-be-all of Windows’ platform development if they don’t include support in Windows PE? That seems like a huge gap in judgement.

Back to the real issue at hand. Since no C#/.NET programs will work I am rewriting the utility entirely in C++. So stay tuned!