SharePoint: Update User’s Display Name using PowerShell
Requirement: I came across an issue where the user display name appeared as domain/username instead of First name Last name.
Solution: We observed, If the user profile sync is not properly configured or running, we’ll face this issue! Other than the UPS solution, You can use PowerShell to update the user’s display name.
PowerShell to change the user display name in SharePoint 2013:
How to change the SharePoint user display name with PowerShell? Well, You can use the Set-SPUser cmdlet. Just provide the account identity, site, and the new display name for the user.
Run this PowerShell cmdlet from SharePoint Management Shell.
Set-SPUser -Identity "i:0#.w|Crescent\Salaudeen" -DisplayName "Salaudeen Rajack" `
-Web https://intranet.crescent.com
Sync User Account Details such as Display Name, E-mail, Department from Active Directory:
Sometimes, user account details may be updated in AD but not synced in SharePoint. If that’s the case, you can force sync user account details such as display name, E-mail, department, etc. from the Active Directory with the below PowerShell script:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#User Account to Sync and Site where the account exists
$UserAccount="Crescent\alex"
$WebURL="https://portal.crescent.com/projects/"
#Get the User's Current Display Name and E-mail
Get-SPUser -Identity $UserAccount -Web $WebURL | Select DisplayName,Email
#Force Sync from Active Directory
Set-SPUser -Identity $UserAccount -Web $WebURL -SyncFromAD
How to Re-Sync All users from Active Directory?
To re-sync all user details, use this PowerShell script:
Get-SPUser -Web https://web-app-url | Set-SPUser -SyncFromAD
Update User’s Display Name for All sites:
Get-SPSite -Limit All | Get-SPWeb | Foreach-object {
Set-SPUser -Identity "i:0#.w|Crescent\Salaudeen" -DisplayName "Salaudeen Rajack" -Web $_ }
hi
they have updated last name in active directory ,but it was not affected how can i synchronize through powershell
thanks