Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, September 28, 2012 8:47 AM
Hello,
I'm using new-aduser to automate user creation while also populating a users home drive letter and path. Within active directory I can see the path and drive letter has been set correctly however the folder on the storage are has not been created so when users log in they do not get their home drive. I have to go into AD users and computers, make a change to the path and click apply. The folder then gets created.
How can I get powershell to work in the same was as AD users and computers so that the users home folder is created as soon as the path is entered?
All replies (7)
Friday, September 28, 2012 9:00 AM | 1 vote
Automatic creation of user folders for home, roaming profile and redirected folders.
Friday, September 28, 2012 9:12 AM
Include a line after you create the user:
md \\servername\home$\$username
Grant Ward, a.k.a. Bigteddy
Friday, September 28, 2012 10:18 AM
That command won't set the correct permissions on the home drive. I'm assuming there's no built in way of doing it in powershell then?
Friday, September 28, 2012 11:47 AM
You may use the script to create HomeDir http://suneworld.com/2012/06/creating-home-directory-for-user/
Сазонов Илья http://isazonov.wordpress.com/
Monday, October 1, 2012 2:31 PM
Thanks for this.
I'm having trouble understanding this. When I run it I get the following type of error:
New-Object : Constructor not found. Cannot find an appropriate constructor for type system.security.principal.ntaccount
.
At C:\ImportUsers.ps1:39 char:31
+ $Account = new-object <<<< system.security.principal.ntaccount($userprincipalname)
+ CategoryInfo : ObjectNotFound: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand
I've populated the $homedir and $samaccountname variables but it still errors.
Thursday, August 29, 2013 9:15 AM | 3 votes
I solved this problem by just highlighting groups of users all at once in ADUC (after creating them in powershell), and then updating the home drive path.
The path would look something like
\server\users.home\username%
Then all of the home folders get created
Thursday, August 11, 2016 1:14 PM
I know this thread is 3 years old, but thank you!!! I just started a new job that had no automation in creating users so I threw together a quick PowerShell script. It worked like a charm except for creating those home folders. Putting in the path with the %username% variable afterwards worked perfectly!