I have seen a lot of people facing a problem in SharePoint 2010, where the UserName is displayed as DomainName\UserName instead of its Full Name. As a solution a lot of people are suggesting to setup the User Profile Synchronization service, but there are organizations who would not like to use it just to fix this issue.
The above image shows that my UserName which was supposed to be displayed as Mukesh Parmar is shown as SharkHeads\Mukesh. This is not right & I would like it to be displayed correctly and without installing and configuring User Profile Synchronization Service.
The fact is you really do not need to setup User Profile Synchronization service, just to show the user’s display name right. We can utilize the existing SharePoint 2010 CMDLet Set-SPUser to set the User Properties in SharePoint or force a Manual User Profile Update from AD [Active Directory].
To change the Display Name we will be using the Set-SPUser CMDLet with the following switches.
Set-SPUser -Identity ‘SharkHeads\Mukesh’ -DisplayName ‘Mukesh Parmar’ –Web http://SharePointServer
Or [To force a manual sync for the user properties from AD]
Set-SPUser -Identity ‘SharkHeads\Mukesh’ –Web http://SharePointServer –SyncFromAD .
Change the above user details as per your environment. Once the command is successfully executed, the changes should now reflect on the site as seen below.
You might be thinking, by using the above CMDLet, I can only change one user DisplayName at a time, I have around 100’s of users having the Displayname in the following format DomainName\UserName. How do I fix those?
No need to panic you can use the following to do the same.
Get-SPUser –Web http://SharePointServer | Set-SPUser –SyncFromAD
The above will fix all users display name in that particular Web Application.
Below are few point to consider:-
- When using –SyncFromAD switch, make sure that the Display Name field is set correctly in User Properties of Active Directory.
- This is not an ideal solution if you are frequently adding new users and changing the user properties in AD. Tho you can schedule the above in Task Scheduler as per your requirement.
- The above will not fix the Display Name for all Web Application in your farm, you will need to run the above command separately for all sites or create a script for the same or you can setup the User Profile Synchronization Service.
- For a full list of switches for the Set-SPUser CMDLet you can check the following link.