0

I'm creating active directory users in bulk from a .csv using powershell. Each user has their profile home folder path mapped to a drive letter. The script runs through fine, users are created and everything looks as expected when checking the profile tab of the user in AD. The problem is, when the users log on, their home folder is not mapped to the drive letter. I'm able to get this working by changing the home folder path manually in AD, then changing it back to EXACTLY what the powershell script set it to, so looking at the user in AD there has been no change. Help?

I'm wondering if it's something to do with the permissions check active directory performs when setting a user up manually - it asks "would you like to grant this user full permission over the home folder" (These users already have full permissions for their home folder due to group membership, so the problem isn't that they don't have permission, but perhaps it's because the check hasn't been done?)

Here's the part of the script that sets the home folder:

-HomeDirectory ($HomeDirStart + $_.OU) -HomeDrive $HomeDrv

Note: This is using the New-ADUser cmdlet

6
  • This is using the New-ADUser cmdlet
    – Charlotte
    Apr 12, 2016 at 16:06
  • It might be permissions but not the obvious ones. Take a look at this support.microsoft.com/en-gb/kb/555046 I know it's for 2003 but home drives hasn't changed really.
    – Drifter104
    Apr 12, 2016 at 17:29
  • After you invoke set-aduser, what does "get-aduser charlotte -prop homedirectory,homedrive" show? Have you debugged output of ($HomeDirStart + $_.OU) and $HomeDrv vars to insure they contain the expected values?
    – Clayton
    Apr 12, 2016 at 18:20
  • @Craig620 - get-aduser shows the correct home directory and home drive. I have debugged the output of ($HomeDirStart + $_.OU) and $HomeDrv vars and they do contain the expected values.
    – Charlotte
    Apr 13, 2016 at 8:27
  • @Drifter104 Thanks. Multiple users have the same home directory. All the users are members of a security group that has full permissions on that folder, including the special permissions listed in that KB.
    – Charlotte
    Apr 13, 2016 at 8:30

1 Answer 1

0

You've set the homefolder in the user attribute, but have you actually created the folder?

And if so, have you assigned rights to that folder? ADUC automatically does these things, but when scripting you have to set them.

For example, after user is created use:

New-item -Path $homedirectory -type directory -Force
2
  • Yes, the home folder already exists and the users have rights to the folder. When I make the manual change to the home folder directory in AD, then change it back to what the script originally set it to, I select "No" to the "Would you like to grant full permissions to this folder" dialogue, so during that process no changes are made to the folder or permissions.
    – Charlotte
    Apr 13, 2016 at 8:11
  • Have you tested giving explicit control for the individual user? Apr 13, 2016 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .