Moving the User Profile location

We needed to move the location of where the user profiles on a Windows 2008 R2 Server are stored from C: to D: .  This turned out to be a bit more work than anticipated - hence this article.

The reason for doing this whoel thing was that I wanted to use the "Connect to Office" function in Sharepoint Libraries on a Terminal Server (okay, on a Remote Desktop Session host...). Whatever I did  - the bugger kept creating a folder in C:\Users\%username%. Redirecting this just didn't work. While creating the folder was no problem, actually using it was a diferent story. Reason: Browing the C: drive on the RDS host (Terminal Server) was restricted by a policy (for obvious reasons). So, since access to C: was restricted, the access to the shortcut folder was being prevented - thus rendering the Sharepoint / Office link useless.

As a workaround we decided to move User Profiless to D: - and allow access to that drive to users (without actually showing it in Explorer, of course). Easier said than done, but eventually I got it to work.

Here's what I did:

  • Add a disk to the virtual machine (duh). I went for a 5Gb disk for starters. Since we're clearing cached copies of roaming profiles when users log off, this should be sufficient. We'll see in production how it fills up.
  • Initialize and format the disk, assign drive letter D:
  • Create folder "Users" on D:.
  • Turn off "Inheritable Permissions" on the folder and set NTFS permissions to be the same as on C:\Users (EXACTLY the same!!)Example of file permissions
  • From another machine, use Robocopy to copy the Default folder to the new location. The reason for doing this was that, when executing the command form the server itself, it seemed to run into some kind of loop and eventually create a humongously long file path in AppData - and render NTFS on the disk useless. The command for Robocopy from the other machine was: \\<servername>\c$\Users\Default \\<servername>\d$\Users\Default /copy:DATSO
  • Also remotely, remove the "Default User" folder (it's a file system junction, actually, but that's for purists)
  • On the server itself, create a symbolic link of type "junction" for "Default User" pointing to the new "Default" folder. In other words, run mklink /J "D:\Users\Default User" D:\Users\Default on the server
  • Note: I decided to keep Public (and its associated links to "All USers", ProgramData, etc) on C: since I had no issues with it being there. If you want to move it - and figure out the dependencies - go right ahead...
  • Fire up Regedit and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
  • Change the values for Default and for ProfilesDirectory to point to D: instead of %Systemdrive% registry settings

Then I did some cleaning-up work:

  • Add a new local administrative user called "Profiler" (or anything else you fancy), reboot the machine and log on with that user
  • Remove the profile of user Administrator & reboot
  • Log on as Administrator, check if the profile is being created in D:\Users
  • Remove the profile of Profiler and then remove that account.