Thursday, February 10, 2011

Moving C:\Users and C:\ProgramData to D:\Users and D:\ProgramData in Windows Server 2008 R2 after Windows is installed

This procedure will free up space on C drive and keep user's data on D drive. It will also create new user profiles on D drive and will not affect current user profiles (now on D drive instead of C drive).

1. Boot into Windows Server 2008 R2 Setup and select "Repair your computer" then select  Recovery Tools and then "Command Prompt" from System Recovery Options.

2. When in recovery mode the disk drives end up with different drive letters than what the normally have.

Find your drives: (C or X or virtual/temp Windows drive); (D or E for system drive C); (D or E for D drive)

3. Copy C:\Users and C:\ProgramData to D:\Users and D:\ProgramData

robocopy /mir /xj E:\Users D:\Users

robocopy /mir /xj E:\ProgramData D:\ProgramData

/mir mirror files and security

/xj exclude junction points

4. Remove C:\Users and C:\ProgramData

rmdir /S /Q E:\Users

rmdir /S /Q E:\ProgramData

5. Create juntion points

mklink /J E:\Users D:\Users

mklink /J E:\ProgramData D:\ProgramData

Do not use the /D switch. Using /J, when Windows looks for the C:\Users dir, it will find it! But it will be on the D: drive instead of the C: drive. It will allow access to files within the directory via Windows Explorer and Command Prompt.

6. Verify.

dir e:\

you’ll see: "Users [D:\Users]" and "ProgramData [D:\ProgramData]" on the C: drive.

7. Restart server and log back in to see the changes.

dir c:\   /a

dir d:\   /a


Disclaimer: Althought this worked for me, it's probably not supported by Microsoft as per KB article KB949977


Windows Automated Installation Kit for Windows 7 documentation (May 2010 Update)

Download: http://www.microsoft.com/downloads/en/details.aspx?familyid=F1BAE135-4190-4D7C-B193-19123141EDAA&displaylang=en

Unattended Windows Setup Reference for Windows 7 CHM

The FolderLocations setting specifies the location of the user-profile and program-data folders.

Windows Vista

ProfilesDirectory

Use this setting only in a test environment. If you change the default location of the user-profile directories to any volume other than the system volume, you cannot service your image. Any updates, fixes, or service packs may not be applied to the installation.

ProgramData

Use this setting only in a test environment. If you change the default location of the program-data folders to a volume other than the system volume, you cannot service your image. Any updates, fixes, or service packs may not be applied to the installation.

Windows® 7, Windows Server® 2008 R2, Windows Server 2008

ProfilesDirectory

You can change the default location of user-profile directories to a volume other than the system partition. However, do not move the default location of the user-profile directories to another volume except when deploying to the destination computer during Windows Setup. You cannot capture an image that has a user-profile directory in a nondefault location, because running sysprep /generalize on a Windows image that has user profiles on another volume is not supported.

ProgramData

Use this setting only in a test environment. If you change the default location of the program-data folders to a volume other than the system volume, you cannot service your image. Any updates, fixes, or service packs may not be applied to the installation.


Moving folder locations during deployment using unattended installation from installation media method.
1. Download and install the latest WAIK for Windows 7/Server 2008 R2 from Microsoft.
2. Use Windows System Image Manager WSIM to create the answer file. 
   a. Create, format and modify partitions using Microsoft-Windows-Setup/Disk Configuration component
   b. Specify OS image install location using Microsoft-Windows-Setup/Image Install/OSImage/InstallTo 
   c. Specify folder locations using Microsoft-Windows-Shell-Setup/FolderLocations
   d. Validate, and save file as AutoUnattend.xml
3. Copy AutoUnattend.xml file to removable media (USB flash drive, floppy disk or image)
4. Boot system to be deployed up from DVD media or ISO image and make sure removable media (Usb flash drive, floppy disk or image) is inserted so setup can find the autounattend.xml file and use it for unattended installation.


 References:
http://www.windowsnetworking.com/articles_tutorials/Deploying-Vista-Understanding-Windows-AIK.html