Putting User Directory on Mapped Network Drive on Windows 7

5

1

I want to relocate my user directory C:\Users\Edwin to a mapped network drive E: (i.e. mapped from a network share \\\\192.168.22.9\share).

The difficult part is in relocating the user directory itself. I found 2 possible solutions, both of which were not applicable to me due to my use of a network drive.

  1. Moving C:\Users\Edwin" to "E:\Users\Edwin and then use junction symlink (mklink -J) to link back to C:\Users\Edwin.

    This doesn't work for me because i can't create a junction symlink from a directory on a non-local drive.

  2. Changing the value of registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProfilesDirectory from %SystemDrive%\Users to E:\Users BEFORE creating the "Edwin" user.

    Thereafter, when "Edwin" user first logs in, the profile will be in E:\Users\Edwin.

The problem with this is that I run into a chicken-and-egg problem.

On first login as user "Edwin" the profile will be created in E:. However, at the moment I first login, the mapped network drive E: isn't there.

I've tried the following to no avail:

  1. Create a persistent mapped drive as Administrator. Didn't work. The mapped drive is only visible to the Administrator user.

  2. Create a persistent mapped drive using system rights (using PsExec -s). Didn't work. The mapped drive isn't "owned" by anyone, not even the current Administrator user.

  3. Create a persistent mapped drive using the newly created Edwin user, without logging in as Edwin yet (using PsExec again). Didn't work. While is possible to create a mapped drive as a different user, once i tried to do it persistently (/persistent:yes), i get a Access is Denied error.

Any idea how this can be done? Or whether it even can be done at all?

Edwin Lee

Posted 2010-12-14T23:07:31.897

Reputation: 179

How about redirecting to the UNC path instead? – afrazier – 2010-12-15T01:04:54.273

This is impossible. Windows constantly writes to the user profile, so performance would slow to a crawl. – kinokijuf – 2013-02-07T13:00:55.937

Also, the kernel holds a lock on %USERPROFILE%\NTUSER.DAT (the registry) and this happens on a lower level than UNC. – kinokijuf – 2013-02-07T13:02:28.260

Answers

4

This is a bad idea. The problem is that mapped drives vary by user, and so drive E: cannot exist until after you've already logged in and loaded your profile. You might get it working via UNC path (\server\share), but I still don't recommend this.

A better alternative would be using Roaming Profiles, but IIRC that requries active directory.

Joel Coehoorn

Posted 2010-12-14T23:07:31.897

Reputation: 26 787

2

I came here to find a solution to this problem, too. Your second suggestion actually answers the question that I came here with.

I also knew that it wouldn't work to just link the user folder to a network drive, because they wouldn't be available at login. I haven't done it yet, but I'm planning to combine this with Offline Files. That would give you the performance of your disk and also make your user directory available on slow links or when there isn't any network connection at all.

I know this issue is more than 2 years old, but I figured that maybe you are still interested.

I've also looked into Roaming user profiles, but decided against it due to its many flaws.

Dominik

Posted 2010-12-14T23:07:31.897

Reputation: 121

1

I'd be interested to know why you would want this. Are you sure this would be a good solution to whatever you wanted to achieve, even if it were possible?

  • If it is in order to protect your privacy, why not just keep the user folder to a minimum? That is, run Firefox and whatnot from E:, make sure the cache folder is also on E:, and set any folders that those programs use, such as the Downloads folder, to E:. And set My Documents to some folder on E.

  • If it is in order to always have your personal data available at any place, why not set up a real-time backup to your E: drive? There are programs that can do this.

Cerberus

Posted 2010-12-14T23:07:31.897

Reputation: 593

2i am actually running Windows 7 in a VM, for security, and restoring a known-clean snapshot at the end of each use. However, i also want to persist user settings like desktop, firefox settings and bookmarks, etc. On top of that, the network drive i'm mounting is actually a NAS with raided HDDs to minimise data loss. i don't really understand, why is it a bad idea? – Edwin Lee – 2010-12-16T13:08:18.813

1

What you're trying to do is called folder redirection, and windows has native support for it. I've never done it on a stand-alone computer, but for a windows domain you can make it happen via GPO. That GPO changes a few registry keys, which should be quite doable manually.

That should automatically activate offline files, so you'll be able to access (a copy of) your home folder even when the share is unavailable.

This guy seems to have got it working.

Microsoft article about folder redirection in general.

Also, to copy a user profile, reboot, then login with another account with administrator privileges and use these instructions. (Not sure if it works exactly the same on windows 7, but the same button should be there somewhere.)

The chicken-and-egg problem should be quite circumventable by using a UNC path instead of E:.

azzid

Posted 2010-12-14T23:07:31.897

Reputation: 353

0

My suggestion:

  1. Create the new user and log into the new account.
  2. Create the network mapping.
  3. Log off.
  4. Log into an administrative account.
  5. xcopy /s /h /g /k /o c:\users\Edwin* \\192.168.22.9\share\
  6. Registry edition:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProfilesDirectory
    
  7. Try to log into Edwin to see if it works.

Stefan

Posted 2010-12-14T23:07:31.897

Reputation: 1