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
Const DRIVE_LETTER = "H:"

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.

UPDATE - Script download link: http://www.briandesmond.com/blog-attachments/createhomefolders.zip  

Posted Thursday, April 26 2007 8:14 AM by Brian Desmond | 3 Comments
Tagged as: , ,

Comments, Trackbacks, & Pingbacks

#1 re: Script to Create Home Folders for OU

Friday, August 17 2007 11:38 PM by Rolros

Excellent Brian

I am planing on using your script. Could you please explain how to modify the xcacls call to add full control to all created folders to the administrators group?

Thank you,

#2 re: Script to Create Home Folders for OU

Wednesday, January 02 2008 3:56 AM by Rajesh

Line: 33

char: 1

Error: An invalide directory pathname was passed

Code: 80040E37

Source: Active Directory

line no. 33 is

Set rs = cmd.Execute

\\cimrserver\test does exists

using admin a/c

rajesh

rajeshdd@gmail.com

#3 re: Script to Create Home Folders for OU

Monday, December 29 2008 8:25 AM by Keith S

Line: 33

Char: 1

Error: Table does not exist

Code: 80040E37

Source: Provider

Now what?

Leave a comment