• When you login to an Azure AD joined system, the user home directory path is usually set to ‘C:\Users<UPN>’ where ‘UPN’ is the user principal name that is set for that user in Azure AD. Also, UPN has its format as ‘abc@domainname.com’ where ‘abc’ is the logon attribute assigned or created during user creation.
• So, if you try to create users or modify user principal names of the users that would be created or are created already by excluding alphabets ‘a’ and ‘o’, then then user home directory that would be created automatically in the default path would not include the alphabets ‘a’ and ‘o’. Thus, for creating new users in bulk without the alphabets ‘a’ and ‘o’, use the following powershell script but also keep in mind to modify the Bulk users csv file with the required UPN naming changes and then run this script accordingly: -
‘ Connect-AzureAD
Import-Csv -Path “E:\Data\ADUsers.csv” | foreach {New-AzureADUser -
DisplayName $_.DisplayName -FirstName $_.FirstName -LastName $_.LastName -
UserPrincipalName $_.UserPrincipalName} | Export-Csv -Path
“E:\Data\Results.csv” ‘
• Once the UPN attribute has been changed with the required changes, then logging in the azure AD joined machine, the user home directory will be created afresh with the name of the UPN of the logged in user. Incase, if you want to change the user home directory, you will have to change it through the registry editor of the local machine as below: -
Logout of the azure AD user and login with the local administrator account.
Copy the Azure AD user profile to the new location, ensure proper permissions are set.
Modify the registry value of ProfilesDirectory under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList to point to the new location.
Please find the below links for more understanding: -
https://learn.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-users-profile-azure-portal
https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/users-bulk-add