Going from “domain\username” to Display name in SharePoint

While at a client location this week I ran into the situation of their SharePoint deployment recognizing a handful of people by their Display Name and others (a lot more) by their “domain\username” account.

And since they had User Profile in place they felt something was just not right, and if you combine that and the fact most of the information available around that issue tells you it is a profile issue, you can understand the frustration of going back to the sync process and correcting in AD, trying this and that and nothing would fix it.

How else to fix it?  Over time I have come to just rely on man’s best friend, I should say “SharePoint’s best friend, PowerShell will always have “a fix for that”.  If we look at what is available, there is Get-SPUser and Set-SPUser.

What does Get-SPUser give me?

(more info on Get-SPUser)

The main thing I was after was to review the info on the user information store (details from AD) passed on to SharePoint.  And there it was, it gave me back the username and the Display Name.  The command used:

Get-SPUser –Web http://

Time to try what options Set-SPUser would allow me to use.

(More info on Set-SPUser)

As the premise for PowerShell goes, we are now used to seeing the type of commands, like Get which will help us retrieve information.  Then we have Set, which will help us modify/change values.

The command to do a one user sync would like this:

Set-SPUser –Identity ‘\ –SyncFromAD –Web http://

And we are set …

What is it you say?  What if this is to be done for every user?

Keep in mind PowerShell has an iterative nature.

Therefore, what if we combined both commands above to retrieve the user and then pass it on to the next command to synchronize from AD.

Here it is:

Get-SPUser –Web http:// | Set-SPUser –SyncFromAD

Ok, that is it for now, give it a go and enjoy Display names with your SharePoint deployment.

This article is part of the GWB Archives. Original Author: Enrique Lima

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.