Moving Windows 7 User Profiles during Installation

I am one of those guys that prefer to separate my user data from the operating system data, and in this post I am going to show you how I install user profiles on an alternate drive during a Windows 7 installation.

There are many ways to achieve the same result, such as using post build scripts and the like, however this is sufficient for what I would like to achieve.

I am going to skip the initial steps of the Windows 7 installation. I am starting from the first user interface prompt where Windows 7 asks you for a user name for your account and allows you to name your computer.

 

image

Fig 1. Select a user name and name your computer

When you reach this screen, DO NOT PROCEED ANY FURTHER. The next step is to modify some of the Windows 7 defaults which can be done using the command line.

Action: Press SHIFT + F10 – this will open the command prompt seen in Fig 2.

 

image

Fig 2. The windows command prompt

The next step is to open the Computer Management Console and to configure the local hard drives.

Action: Type “compmgmt.msc” at the command line and hit ENTER

 

image

Fig 3. The Computer Management Console

This is the place where you manage almost all aspects of your computer. The part we are interested in is the “Disk Management” console.

Action: Select the “Disk Management” option from the left hand pane.

 

image

Fig 4. The standard disk management console for a new installation of Windows 7

Action: Arrange your hard drives and allocate drive letters are required.

 

image

Fig 5. The disk management console with the hard drives prepared and drive letters applied

Action: Close the computer management console and return to the command prompt.

 

image

Fig 6. Back to the command prompt

We have prepared the hard drives and partitions, and they are ready for us to change the Windows 7 defaults. The next steps are to copy the default files and folders from the C:\ drive to the D:\ drive or any other drive or partition that you would prefer to use.

We are going to be using Robocopy, an XCopy tool that is built into Windows 7, to copy the directories.

Actions:

  1. Copy the Users directory from C:\Users\ to D:\Users\
    Enter the following command at the command line to achieve this:
    Robocopy.exe C:\Users D:\Users /E /COPYALL /XJ
  2. Copy the ProgramData directory from C:\ProgramData\ to D:\ProgramData\
    Enter the following command at the command line to achieve this:
    Robocopy.exe C:\ProgramData D:\ProgramData /E /COPYALL /XJ

Notes:

For a full listing of the Robocopy switches, please visit: Robocopy Syntax, Command Line Switches and Examples.

 

image

Fig 7. The results of the Robocopy commands being executed

 

image

Fig 8. Open the Windows 7 Registry Editor

Action: Type “regedit” at the command line and hit ENTER

 

image

Fig 9. The Windows 7 Registry Editor

Action: Navigate to the Windows 7 Profile List Registry Settings

Steps:

  1. Locate the “ProfileList” in the following location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
  2. Update the following 4 registry settings from %SystemDrive% to D:\ (If you have chosen to use the D:\ drive as the new location)
    1. Default – D:\Users\Default
    2. ProfilesDirectory – D:\Users
    3. ProgramData – D:\ProgramData
    4. Public – D:\Users\Public
  3. Reboot the machine by running the following command
    shutdown /r /t 0

The reason for the reboot is to allow Windows to relocate its temporary ProgramData files into the new location.

 

image

Fig 10. Remove the original Windows directories

Now that Windows 7 has been restarted, it should have moved its ProgramData files to the D:\ Drive. It is now time to remove the C:\Users and C:\ProgramData directories.

Action: Remove C:\Users and C:\ProgramData

Steps:

  1. Remove C:\Users by running the following command:
    rmdir C:\Users /S /Q
  2. Remove C:\ProgramData by running the following command:
    rmdir C:\ProgramData /S /Q

 

image

Fig 11. Unable to remove a directory due to locked files

You will not necessarily come across this step, however if you do, try another reboot.

Action: Reboot the machine by running the following command: shutdown /r /t 0

 

image

Fig 12. Create file system junctions to handle dodgy software

Junctions allow older software with hard coded paths to still operate once you have moved your profile data by acting as a pointer and allowing C:\Users to still appear valid even though the data is now on the D:\ Drive.

Action: Create junction for C:\Users and C:\ProgramData

Steps:

  1. Create the C:\Users junction by running the following command:
    mklink /J C:\Users D:\Users
  2. Create the C:\ProgramData junction by running the following command:
    mklink /J C:\ProgramData D:\ProgramData
  3. Reboot the machine by running the following command
    shutdown /r /t 0

 

image

Fig 13. You are now back at the Select a user name and name your computer

Action: You are now free to create a user name, name your computer and then log in once complete.

 

image

Fig 14. Logged in to the newly built Windows 7 machine

The junctions that you created above are visible in the root of the C:\ drive, and when you click on them it appears as if the files are on the C:\ drive, however they are really on the D:\ drive.

 

I hope this helps a few of you, especially if you have been stuck in the past trying to move C:\ProgramData to another drive.

Windows Azure Data Centre Locations

For those of you that want to know the specifics of the Windows Azure Data Centre Locations, this is what I have found:

  • North Central US – Chicago, Illinois
  • South Central US – San Antonio, Texas
  • West US – California
  • East US – Virginia
  • North Europe – Dublin, Ireland
  • West Europe – Amsterdam, Netherlands
  • East Asia – Hong Kong
  • Southeast Asia – Singapore
Windows Azure Data Centre Locations
Windows Azure Data Centre Locations

The information above is based on what I have found on the internet, and not from Microsoft.