2013.01.02 – An important note that I just found is that you cannot do a in place upgrade of your OS if you do change the location of your Users directory to a new location. I would assume if you are techie enough to do this you would not be doing in place upgrades instead you would be doing fresh installs, but click here for the MS KB article if anyone is curious.
You may have read my other post Windows 7 – How To Move The Entire User Folder To A Different Drive. In this post I explained how you can move the User folder to a different drive using ROBOcopy and a few tricks to get Windows to be okay with the Users folder in a different location. This solution has worked for me for some time and I have had no issues even deploying this method at work. The thing that bothered me though is that ROBOcopy cannot copy symbolic links or junctions which meant that all the these items no longer existed in the new Users location. Me being me I decided to set out and find a better way to copy the Users folder and all its special folders to a different location. What I found was a lot of other sites explaining the exact same thing as I did, so I felt better knowing that I was not the only one doing it this way.
I first started my search by looking for a command line tool that would allow me to properly copy the Users folder and its junction points and symbolic links. I was also looking for a tool that was a built in tool so that I didn’t need to download or install something. After a week of searching I followed a couple of links to a site that started to talk about making an unattended answer file for Windows and then you can specify where you want your special folders to be located. I was aware of using an Unattended install files through my years of IT and I don’t have an issue using them. What I do not like about unattended install of Windows is that you have to create media that is only good for one certain install. I also did not feel like creating a custom installer to be honest, I am lazy. So an unattended install was a solution but not the perfect one I was looking for.
By chance I was looking through the comments on an article about how unattended installs work and read a comment then mentioned something called “Windows Audit Mode”. I can admit that I do not know everything about Windows but normally I have at least heard of most things. Windows Audit Mode was something I had never heard of before so my mind wanted to know what it was.
I decided to look this up on Tech Net and there was a Microsoft article on it. This Audit Mode looked very promising and it is already built into every Windows installer DVD. After doing some playing around and some experimenting I found this Audit Mode did exactly what I wanted and I would like to share with everyone how I got Windows to move the Users folder for me all legit and all using built in tools from Windows!
Please note this has to be done from a fresh install. You cannot change the location of the Users folder after you have already started to use Windows already!
- Install Windows just like you normally would, set your partitions up etc…
- You will get to a point in the install where it asks for a user name and a computer name after a reboot, this is called the OOBE setup. If you do not get this OOBE screen then you might have a customized installer from your maker of your computer and I am not sure how to force your installer into Audit Mode, if anyone has a way please let me know in the comments.
- On this first screen you will press “Ctrl+Shift+F3” (press and hold Ctrl+Shift then hit F3).
- Your system will reboot and you will boot into a Windows desktop.
- A System Preperation (sysprep) application will start automatically, click cancel to this program.
- You are now in something called Audit Mode, time to do some magic.
- At this point make sure all your drives are set up in their proper order and have their proper drive letters.
- You will need to create an unattended file that will need to be on the machine that is in Audit Mode. You are welcome to type it out but the chances for error are way to high. If you have internet on the new machine and the drivers are installed you can copy paste from below (short link to this post http://caspan.com/?p=579), if not you will have to use a second computer to copy the script below and then copy it to the new machine.
move.xml123456789101112<?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 PROFESSIONAL" xmlns:cpi="urn:schemas-microsoft-com:cpi" /></unattend>
- In the file above note the following changes that might have to be made:
Line 4 : For Windows x64, change “prosessorArchitecture” to “amd64”
Line 4: For Windows x86, change “prosessorArchitecture” to “x86”
Line 6: Change the location of “D:\Users” to the location of your choice
Line 7: This whole line is optional. If you do not what to change the location of ProgramData then remove this entire line. If you do then change the Location of “D:\ProgramData” to the location of your choice
Line 11: Change the letter E in “wim:E” to the drive letter your DVD that has your Windows 7 installation DVD
Line 11: Change the edition to one of the following HOMEBASIC, HOMEPREMIUM, PROFESSIONAL, ULTIMATE, ENTERPRISE depending on what version you are installing.
- Save this to a file called move.xml. The name is not important but no spaces is ideal because we will be calling it from the command line so no spaces equals easier.
- This file will need to be on the machine that is in Audit Mode, I normally put this on the D drive for as it is easy to find.
- On the new machine open cmd.exe from the run dialog
- Change your directory to “C:\Windows\System32\Sysprep\”
- From here you can run the following command “sysprep.exe /oobe /reboot /unattend:D:\move.xml” where D:\move.xml is the location that you saved your file to that we made earlier.
- You should see a small window open that says “Syusprep is working” and a small progress bar.
- The machine will reboot and boot back into that first OOBE screen and you can do the rest of you setup as you normally would.
- Once Windows come up you can check your system and now you will see that your user drive has been moved.
At this point you can continue to use Windows just like you normally would but there are a few steps that I like to take to make sure that if for any reason a bad programmer calls the C:\Users folder or C:\ProgramData by its name instead of using system variables then we need to account for this. What I like to do is create 2 Junction point to cover this issue should it ever happen.
If you open a command prompt you can create the junction point by doing the following:
- mklink /j C:\Users D:\Users (where D:\Users is the new location of your users folder)
This will create a Junction point so that if any program ever calls to these old location it will point it to the new location. This will help just in case some badly written application makes a call to the old location.
Please if there is any questions or any comments please feel free to post them below. I love hearing feedback if this worked for you or not. I really hope this helps others out as it has helped me out a lot finding this tool.
© Caspan 2012