Hi @PKU
Thank you for posting this in Microsoft Q&A.
I understand you want to Create a naming convention for local user profile name when singing in with a M365 user.
You can use PowerShell to automate this process.
Install-Module -Name AzureAD
Import-Module -Name AzureAD
Connect-AzureAD
$userid = "replace user object Id"
$userdetails = Get-AzureADUser -ObjectId $userid
$displayName = $userid.displayname
$firstName = ($displayName -split '\s+')[0]
$lastName = ($displayName -split '\s+')[1]
$companyName = ($displayName -split '\s+\|\s+')[1]
$abbreviation = $firstName.Substring(0,1) + $lastName.Substring(0,1) + $companyName.Substring(0,1)
Set-AzureADUser -ObjectId $userid -DisplayName $abbreviation
To update bulk users, create a CSV file as userIDs.csv with UserID
$userIDs = Import-Csv -Path "userIDs.csv" | Select-Object -ExpandProperty UserID
foreach ($userID in $userIDs) {
# Retrieve user details
$userDetails = Get-AzureADUser -ObjectId $userID
$displayName = $userDetails.DisplayName
$firstName = ($displayName -split '\s+')[0]
$lastName = ($displayName -split '\s+')[1]
$companyName = ($displayName -split '\s+\|\s+')[1]
$abbreviation = $firstName.Substring(0,1) + $lastName.Substring(0,1) + $companyName.Substring(0,1)
# Set new DisplayName
Set-AzureADUser -ObjectId $userID -DisplayName $abbreviation
}
Hope this helps. Do let us know if you any further queries.
Thanks,
Navya.