Working on a script to automate the creation of new users, it works and the user shows up, but their home directory is not created.
For example I use New-ADUser
to create "Joe User" with a username of "joeu" and HomeDirectory
of \\\\svr-home\\home\\%username%
Normally when you enter this same string directly into the AD during the creation of a new user, when the OK button is clicked the %username%
part is automatically replaced by "joeu" and a folder is created at \\\\svr-home\\home\\joeu
with all the appropriate permissions.
When I check on the account in AD, the script has set the value for the 'Home Folder' field, but the AD variable is never completed and the matching folder is not created.
If I manually edit the user in AD and click the Apply button, the home path is resolved and the folder is created. Is there a way I can force AD to execute this step?
Or do I have to manually create the home folder and set its permission and then use the actual path information for the -HomeDirectory
parameter to solve this?