# Creating home drive folders for users without one

Of course I know that one can use the “Home folder” option in the Profile of the user in Active Directory.  Due to certain constraints of a situation I inherited, that’s really not an option for now.

I need to do it in bulk, for a bunch of active user accounts within a specific OU.  Additionally, I don’t know if the user has a folder or not.  Nor do I feel like waiting for these users to login and then have the folder created.

Luckily for me, I have a ton of storage and a single location for user home folders.  I simply want to walk through all the users in a specific OU, like “…this\path\to\my\ou\…”  If the folder does not exist, then go ahead and create it.

$homePath = "Q:\UserHome\"$userHome = get-aduser -filter {enabled -eq $true} -properties SamAccountName,CanonicalName foreach ($ADUser in $userHome) { if ($ADUser.CanonicalName -like '*/myOu/Path/*')
{
$userHomePath =$homePath + $ADUser.SamAccountName if (-Not (Test-Path$userHomePath))
{
New-Item \$userHomePath -Type Directory
}
}
}