2

I know there is a group policy where I can map a specific share. What if I want the group policy to create a folder on that share and map it during log on?

I know there must be a way to do this in PowerShell. Or would I not have to even worry about using PowerShell? Could I just simply specify UNC path in the group policy \\servername\share\$username. Should I expect windows to automatically create the folder and map it for the user or is this more complicated?

slybloty
  • 443
  • 2
  • 9
  • 30
  • 5
    You can do this by specifying a home folder in the users' active directory attributes. The folder will be automatically created. Does this work for you? – BlueCompute Mar 06 '15 at 12:45

1 Answers1

0

You can achieve this via AD Users and Computers GUI and via Powershell. What I did in the past is open AD U & C GUI, right click on the new AD user, go to Profile and type in the information below.

enter image description here

What I did in the GUI is select "Connect" under Home Folder, choose my preferred drive letter (in this example, G:) and assign the following user share \ \VandelayInc\Users\%username%. What this does is create the user folder for you in the Users share location specified and map the user folder to the G: drive.

I now do this in Powershell, manually because turnover is little to nothing where I work, using the code below.

Set-ADUser art.vandelay -HomeDrive 'G:' -HomeDirectory \\VandelayInc\Users\%username%

If you wanted to automate the code, I'm sure you could, by supplying variables you know won't change like your Home Drive and Home Directory.

#Establish your static variables
$homedrive='G:'
$homedirectory='\\VandelayInc\Users\%username%'

#Establish your non-static variable the user name
$User='Art.Vandelay'

#Set Home folder for User
Set-ADUser $User -HomeDrive $homedrive -HomeDirectory $homedirectory 

Again, the above isn't the best automated script, but it works and only requires opening and changing the $User variable. Either way, these above options will accomplish the goal of having Windows to create the folder and map it for the user.

Art.Vandelay05
  • 1,354
  • 3
  • 13
  • 27