Category Archives: Windows

Changing the location of the Users directory on Windows 7

I've just set up a Windows 7 PC, and it helpfully asked if I wanted to create one big partition on the (1TB) disk, or to create a separate partition for 'data'.  It offered a default size of 50GB for the 'system', but I chose 100GB, with all the rest for 'data'.  And then it completely failed to put the users' 'My Documents' etc. onto the data partition.  In my experience, very few ordinary Windows users make use of space that isn't in the default location, i.e. My Documents, My Music, or My Videos.

So there must be an easy way to get Windows to put My Documents somewhere else mustn't there?  Well, sort of.  Right-click on My Documents, select Properties, and change the location.  Fine.  But you have to do it for each category, and each user.  And it still doesn't move the application data, registry stuff, or the temporary files etc.

On the other hand, with Windows 7 it's also possible to include arbirtrary directories into the 'library', so that could work for you.

I found a good set of instructions on SevenForums that actually does what I want.  It's a bit fiddly, and I found those instructions incomplete.

So this is my solution.  Ideally do this when setting up the computer from new — otherwise, there will be a lot of registry editing at least, and quite possibly some applications that lose track of their files. 

Notes:

  • Obviously, I take no responsibility for the correctness or suitability of these notes: use them at your own risk. 
  • This is not a step-by-step idiot's guide: the instructions require you to understand the process and make decisions of your own.
  • This is for a home computer — not one that's connected to a domain.

The approach is to use an administrator account to move each of the other accounts (which may themselves be administrators).  If you've got two admin accounts, they can move each other.  Or you can create a temporary administrator account just for this manouevre.  It should also be possible to do this from a bootable CD such as Hiren's, although I haven't tried that yet.

  1. Backup the whole system, because this could all go horribly wrong.
  2. And create a restore point, just in case.
  3. Choose or create an administrator account, which I'll call 'admin'. 
  4. Change the folder settings to make all files (including system ones) visible.
  5. Create a folder on the destination disk/partition — I'll call it X:Users.
  6. For each other user (referred to here as 'user'):
    1. Make sure user is logged off.
    2. Log on as admin.
    3. In Explorer (or by whatever means you choose) Copy and Paste C:UsersUser into X:Users, clicking 'Continue' or whatever to allow it to proceed.
    4. Using regedit (or your favourite registry editor), navigate to HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList and find the S-1-5-long-number entry with the ProfileImagePath that matches user.  Change it from C:UsersUser to X:UsersUser.
    5. Log on as user and take ownership of X:UsersUser.  
    6. If that worked, you can now delete C:UsersUser.
  7. If you want to keep user admin, you'll need to log on as a different administrator, and perform the steps above, treating admin as user.
  8. Then do the same thing for C:UsersPublic and C:UsersDefault.  In these cases, the registry entries to change are HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileListPublic and HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileListDefault respectively: change them to X:UsersPublic and X:UsersDefault.
  9. Now to change the default location for new users created in the future by changing HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileListProfilesDirectory to X:Users.
  10. That's most of it done.  Except that there are probably lots of hard-coded references to C:Users scattered throughout the registry.  Use a registry editor that does bulk search-and-replace, such RegAlyzer, to find and change every C:Users… to X:Users…  And then do a similar edit to change %System%Users… to X:Users…
  11. Then reboot and check that it all works.
  12. If you created the admin just for this maneouvre, you can delete it now.

How to Resolve “mount error(12): Cannot allocate memory” on a Windows Share

[Copied from http://jlcoady.net/windows/how-to-resolve-mount-error12-cannot-allocate-memory-windows-share because it's so useful.]

If you mount a Windows 7 share using Samba/CIFS you may run into “mount error(12): Cannot allocate memory” if you are using very large files on the Windows machine. Looks like in certain situations Windows needs to be told to run as a file server and to expect large files. You can read more details at Large Files are locking up Windows 7 32 bit and 64 bit, but the solution is to make two registry edits and then restart a service:

  1. Set “HKLMSYSTEMCurrentControlSetControlSession ManagerMemory ManagementLargeSystemCache” to “1″.
  2. Set “HKLMSYSTEMCurrentControlSetServicesLanmanServerParametersSize” to “3″.
  3. Restart the “server” service.

Once you have done that you should be able to mount the share using a command like “sudo mount -a” or just reboot the Linux machine.