Hi,
If the first name and the last name are stored in the properties GivenName and Surname you can do it like below
Get-ADUser -SearchBase $ou -Filter * | ForEach-Object {
Set-ADUser $_ -HomeDirectory "\\$fileserver\$($_.Surname)$($_.GivenName[0])"
}
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.