Skip to content

Instantly share code, notes, and snippets.

@dungsaga
Last active July 13, 2024 01:41
Show Gist options
  • Save dungsaga/220d18371e4d9f4b280c331060041aa3 to your computer and use it in GitHub Desktop.
Save dungsaga/220d18371e4d9f4b280c331060041aa3 to your computer and use it in GitHub Desktop.
move user profile folder of windows

move user profile folder of windows 7

  • During installation, instead of typing your username and computer name, press CTRL + SHIFT + F3 to boot into Audit Mode
  • After booting into Audit Mode, click Cancel in the window "System Preparation Tool 3.14"
  • Create a XML file (such as D:\relocate.xml) containing instructions to move user profiles
  • Run %windir%\system32\Sysprep\Sysprep.exe /audit /reboot /unattend:D:\relocate.xml
  • After rebooting again, click OK in the window "System Preparation Tool 3.14"
  • Continue with normal installation

The XML file looks like this:

<?xml version="1.0" encoding="utf-8"?>
  <unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="oobeSystem">
      <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64"
          publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
          xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <FolderLocations>
          <ProfilesDirectory>d:\Users</ProfilesDirectory>
          <ProgramData>d:\ProgramData</ProgramData>
        </FolderLocations>
      </component>
    </settings>
  <cpi:offlineImage cpi:source="wim:E:/sources/install.wim#Windows 7 ULTIMATE"
    xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
  • You should remove the part <ProgramData>d:\ProgramData</ProgramData> if you don't want to move the folder ProgramData.
  • The value of variable ProcessorArchitecture must be amd64 if you are installing a 64 bit Windows, and x86 if you are installing a 32 bit Windows
  • Remember to type the correct drive letter in d:\Users and E:/sources/install.wim.
  • And also don't forget to put the correct edition in Windows 7 ULTIMATE (change it to HOMEBASIC, HOMEPREMIUM, PROFESSIONAL, ULTIMATE, ENTERPRISE)

source: https://staff.ie.cuhk.edu.hk/~sfluk/wordpress/wp-content/uploads/2012/05/Relocate-User-folders-during-Windows-7-installation.pdf

move user profile folder of windows 10

  • When installation reaches the Region Selection screen, press CTRL + SHIFT + F3 to boot into Audit Mode
  • After booting into Audit Mode, click Cancel in the window "System Preparation Tool 3.14"
  • Create a XML file (such as D:\relocate.xml) containing instructions to move user profiles
  • Run %windir%\system32\Sysprep\Sysprep.exe /oobe /reboot /unattend:D:\relocate.xml
  • After rebooting again, click OK in the window "System Preparation Tool 3.14"
  • Continue with normal installation

The XML file looks like this:

<?xml version="1.0" encoding="utf-8"?>
  <unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="oobeSystem">
      <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64"
          publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
          xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <FolderLocations>
          <ProfilesDirectory>D:\Users</ProfilesDirectory>
          <ProgramData>d:\ProgramData</ProgramData>
        </FolderLocations>
      </component>
  </settings>
</unattend>
  • You should remove the part <ProgramData>d:\ProgramData</ProgramData> if you don't want to move the folder ProgramData.
  • The value of variable ProcessorArchitecture must be amd64 if you are installing a 64 bit Windows, and x86 if you are installing a 32 bit Windows

If you want to move user profiles after installation (on an existing installation):

  • You may have to run net stop wmpnetworksvc before running Sysprep.exe

source: https://superuser.com/questions/1577924/can-i-move-the-c-users-folder-to-d-drive source: https://www.tenforums.com/tutorials/1964-move-users-folder-location-windows-10-a.html#MethodTwo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment