Set Active Directory HomeDirectory with Powershell

Need to update the HomeDirectory on a bulk set of users, based on OU? See below. It will set \\SERVERNAME\Username as the home directory. Change the OU path as needed.

Get-ADUser -Filter * -SearchBase 'ou=YourOU,ou=Users,dc=DOMAIN,dc=LOCAL' | ForEach-Object {
	Set-ADUser $_.SamAccountName -HomeDrive "H:" -HomeDirectory "\\SERVERNAME\$($_.SamAccountName)"
}

Steve

Web Developer, IT enthusiast & PC Gamer.

Leave a Reply

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