SharePoint 2013: Update User's Display Name, E-mail 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 UPS solution, You can use PowerShell to update user's display name.
change user display name in sharepoint 2013
PowerShell change user display name in SharePoint 2013:
How to change the SharePoint user display name with PowerShell? Well, You can use Set-SPUser cmdlet.  Just provide the account identity, site and the new display name for user user.

Run this PowerShell cmdlet from SharePoint Management Shell.
#Set-SPUser -Identity "i:0#.w|Crescent\Salaudeen" -DisplayName "Salaudeen Rajack" `

sharepoint powershell change user name
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 active directory with the below PowerShell script:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#User Account to Sync and Site where the account exists

#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 resync all user details, use this PowerShell script:
Get-SPUser -Web http://web-app-url | Set-SPUser –SyncFromAD

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.