Script to Create Home Folders for OU

I thought I’d share the script attached at the end of this post as it’s something I’ve seen requests for below. The script will take all of the users in a given OU (or really any subtree), and create a home folder for them and stamp the path and drive letter on the user object in Active Directory. By default it only grants the users modify permissions on the account. If you want to change this modify the xcacls call around line 54.

There are a few constants which need to be configured at the top of the script which are explained with comments:

‘ The base OU to search (child OUs will be searched as well)
Const BASE_OU = “ou=accounting,ou=people,dc=mycompany,dc=com”

‘ The path to create the home folders in. Must have a trailing \
Const BASE_FOLDER = “\\someserver\Users\”

‘ Home folder drive letter

Feel free to post any suggestions, bugs, etc in the comments area and I’ll take a look. The script is enclosed in a zip as an attachment to this post.

Share this post: email it! | digg it! | bookmark it! | live it!

Leave a Reply

Your email address will not be published. Required fields are marked *