Friday, January 5, 2018

Update user home directory with Powershell

Import-Module ActiveDirectory
$users = Get-ADUser -SearchBase "<Path to Organizational Unit" -Filter * -Properties *

ForEach ($user in $users)
{
$sam = $user. SamAccountName
Set-ADuser -Identity $sam -HomeDirectory "\\server\users$\ $sam"

No comments:

Post a Comment

Thank you for your comment.