Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
If this does create the users folder for them, I recommend you check to ensure it's giving them exclusive access to the folder as you usually don't want all users having read/write to another users folder. You also likely want IT admin group to have full to everything. These requirements have usually lead me to create a script that admin would run at AD user creation time to provision the shared folder with the proper perms. – Bret Fisher Feb 23 '12 at 19:34

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. :)


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.

share|improve this answer
I'm still having issues trying to get the share created and mapped the first time. I will see if I can edit the OP and try to give you a more clear picture of what my permissions look like. – jmreicha Feb 24 '12 at 15:31

The Group Policy to map a drive only actually performs the mapping. It's not capable of creating the share automatically. You'll have to do this programatically, probably by way of a login script.

This link is to a GREAT blog post detailing how to create a PowerShell script that will check for the presence of a directory, and if it does not exist, it will create it (and I think the script goes so far as to share it).

If you couple pieces of the login script with your GPO, you'll have a solution that suits your needs.

share|improve this answer
I think this might be what I'm looking for. I just wasn't sure one way or another if the Group Policy setting would enable me to create the directory if it did not exist. – jmreicha Feb 24 '12 at 17:04
Unfortunately not. The GPO (in its current iteration) only allows you to create a new mapped drive if it doesnt exist, modify an existing mapped drive, or remove a mapped drive. It only applies to the mapped drives however, and not the shares themselves. – JohnThePro Feb 24 '12 at 17:07
That's good to know. I'm looking at the Powershell Option now. I will update my answer with the working script. – jmreicha Feb 24 '12 at 17:16

I suspect that for this to work, you have to configure the 'root' folder (Users) in the manner used for Redirected profiles or Redirected folders.

Example Permissions

In this example, the 'special' permissions for CREATOR OWNER & Authenticate Users are:

CREATOR OWNER: Full Control - 'Subfolder and Files Only'

Authenticated Users: 'List folders/Read data' and 'Create folders/Append Data' - This folder only

share|improve this answer
up vote 0 down vote accepted

I had to use a combination of two different scripts for this to work. I first run a powershell script that checks to see if a directory exists and if it doesn't, creates it.


$share = $env:username
$sharepath = "\\fileserver\Users\$share"

If (!(Test-Path $sharepath)) {
New-Item $sharepath -type Directory

The next script just deletes the old share name and mounts the new share.


@echo off
net use * /delete /yes

net use z: "\\fileserver\Test Network"
net use u: "\\fileserver\Users\%username%"

I have a group policy set to run the powershell script and then run the bat file to map the drives at user logon.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.