Create and map drive based on login

group-policywindows 7windows-server-2008-r2

I want to create a folder for each user if they do not already have one on a Windows file server when the user logs in each time.

So for example, I have user "jdoe", I would like to be able to create a share called "jdoe" automatically the first time this user logs in. And subsequently make this share available every time this user logs in after the share is created.

I have the policy working to the point where, if I manually create the share name for the user, the network drive gets mapped correctly. The last piece would be to create the share if it does not exist.

The policy setting looks like this:

enter image description here

Is there is a way to fully automate this process/policy or does this need to be done with a custom logon script or something?

Update 1:

These are what the folder permissions look like. Maybe this will help give you a better clue as to why the share isn't being created the first time the drive is mapped.

enter image description here

And here are the advanced options for Authenticated Users.

enter image description here

Update 2:

I have something working now at least, although I don't really think this is the best or cleanest way to do this. I have created two scripts, 1 for creating the share if it does not exist and the other to map the share.

I'm thinking that there has to be an easier, or at least less complicated, more obvious way to do this?

Best Answer

The problem at this point is likely the permissions on the folder \\server\share.

The user or the computer account (I don't remember which... been a while) needs to have the ability to create the new folder %username%. Check both the NTFS and share rights. From there it should occur on its own. At least it did when I still needed to set this up. :)

EDIT -

I think that this was user accounts, not computer. I tended to use 'Authorized Users' for this setting.

Also you should be able to grant the "Create Folder" right to the "Only This Folder" setting on the shared folder. That should be the minimum to do what you want.

EDIT - See the official documentation on the subject here. Specifically look at the "Folder Redirection permissions" section.