Creating a home directory and drive in AD using Power Shell

We use a script to create a new AD user. Part of that script sets the users profile to a logon batch file and then creates a home drive letter and a home directory on the NetApp filer. The path is \\XX-XXX\home$\username.

The script work fine, but it doesn't create the home directory on the NetApp. I've tried deleting the line in the script and substituting:
Set-ADUser <user> -HomeDirectory "<folder path>" " -HomeDrive "<Drive letter>"., but still no go.

YET, when I go into the user's profile, change 1 letter in the path, it then creates the home folder.

NetApp tech support, while great, couldn't find the line (we used packet trace while repeating the process with a test account) that actually generated the command to create the folder.

Any ideas? I create a lot of users, especially temporary and adjunct professors and since school with start in a few weeks, I'm already getting swamped. Anything to help automate and streamline this (without me having to manually manipulate the profile) would be greatly appreciated.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
Something like this seems like a permission issue for NTFS or Share permissions. Have you been able to check any of the logs to see why it does not create the folder initally?

I would also see if you can create another location on your NetApp (new drive) and see if it works pointing it there.

wheelgunrAuthor Commented:
None of the logs show why this is happening. I worked with NetApp Tech Support for 3 hours, and nothing showed up in the logs or packet traces.

I tried your suggestion, and nada. I do remote into the operational server using my domain admin account. Domain admins have full control of the top home directory, and all of the other subfolders carry the same permissions for administration. Each user has full permission to their own folder, as does the NAS admin, domain admin, infrastructure, etc.

When I just delete one letter in the user's name and re-type it, the home folder is created. That makes me think it's not a permissions issue.
Will SzymkowskiSenior Solution ArchitectCommented:
What about a charachter limitation? Do you have any other storage outside of NetApp that you could use and test with? Possibly Local Storage? If you can get this to work outside of the NetApp appliance then it has something to do specifically with NetApp.

wheelgunrAuthor Commented:
Nope, not exceeding the character limits. I've tried doing the same on a separate VM server, as well as on a physical server. I created a directory "Home", shared it,  gave "everyone" full control, specifically added domain admins and infrastructure, and nothing. It wasn't until I returned to the test profile, deleted and added one letter of the name, and showed up...

I have no idea what's going on. Obviously I just eliminated NetApp as the culprit.
Will SzymkowskiSenior Solution ArchitectCommented:
This is a pretty straightforward task. If you have setup the Share/NTFS permissions accordingly it should just work. There is nothing wrong with AD. it just points to the directoy you specify and if it has the correct permisisons etc it creates the users directory.

If there are no logs or other indicaitons as to what is happening it is very difficult for someone that has NEVER seen your environment to know what is going on.

I am simply providing things to test/look for to ensure that everything is set properly.

If you have mis-configured your AD environment some how, only you will know that.

The only other thing i would check is if your DC's are communicating  properly (replicating). Use the following commands...

repadmin /replsum
repadmin /showrepl
DCDiag /v

If you think it is actually with AD then check DC health and Replication. However i have never seen something like this where you change a character in the home drive path and then it creates the directory. Out of the box it does not work like this.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.