Moving Windows 7 ProgramData folder after installation

I need to move my C:\ProgramData folder in a Windows 7 installation to D:\ProgramData.

I understand how to make the symlinks and registry changes so this works. My problem is that I'm unable to copy the files in the ProgramData folder because the OS seems to have some of them locked.

Specifically, the files in the C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys folder are blocking the move.

Am I out of luck here? Is there any way to move the folder, create the symlink, and update the registry without any of the files in these folders being locked?


Solution 1:

Move the Profile and ProgramData

start from Windows 7 DVD and choose to repair Windows, open Command Prompt (CMD) and type:

move the "Users" folder to the second partition by this command.

  1. ROBOCOPY "C:\Users" "D:\Users" /COPYALL /MIR /XJ.

move the "ProgramData" folder to the second partition by this command.

  1. ROBOCOPY "C:\ProgramData" "D:\ProgramData" /E /COPYALL /MIR /XJ.

delete the "Users" folder from C: partition.

  1. RMDIR "C:\Users" /S /Q

make Junction link to Profile folder in second partition.

  1. MKLINK /J "C:\Users" "D:\Users"

delete C:\ProgramData (ignore any failed massage)

  1. RMDIR "C:\ProgramData" /S /Q

open the Registry Editor and change the profile values to the new path.

  1. REGEDIT.

navigate to this path: HKEY_LOCAL_MACHINE -SOFTWARE -Microsoft -Windows NT -CurrentVersion -ProfileList and change the values to the new path.

after windows restart open CMD as Administrator and delete C:\ProgramData

  1. RMDIR "C:\ProgramData" /S /Q

make Junction link to ProgramData folder in second partition.

  1. MKLINK /J "C:\ProgramData" "D:\ProgramData"

Solution 2:

Caveat: I've never done what you are asking before, but...

You can get easily get around the copy problem by down loading a Linux Live CD such as Ubuntu, and booting from it. You will be able to access your drive, and copy the folder from one location to the other.

When you reboot you can make the registry changes, reboot, and thereafter you ought to be able to delete the original.