First of all, the "Home Folder" attribute is a legacy thing. You should probably use either GPO Folder Redirection or a GPO Mapped Drives policy that includes the %username%
variable to match the folder name.
If you use Folder Redirection, you can configure it to create the folders for each user if they don't exist. This is the easiest way.
You can certainly script all of this if you don't go the redirection route, but it highly depends on your environment. If you're using PowerShell (which you should), you're going to want the get-aduser
, get-acl
, set-acl
, and new-item
cmdlets at a minimum.
You can find out more info and see examples on all of these using the get-help <command> -full
command. In order to use get-aduser
to enumerate your existing users, you're going to need the AD PowerShell module. You get this from installing the AD Command-line tools in RSAT.