Geeks With Blogs

Disclaimer: The views expressed on this blog are my own and do not necessarily reflect the views of my employer.

Creative Commons License

Check out my profile!

INETA Community Speakers Program

Follow enriquelima on Twitter
Locations of visitors to this page

Intentional Thinking Enrique Lima

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://<name of web app>

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 ‘<domain>\<username> –SyncFromAD –Web http://<name of web app>

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://<name of web app> | Set-SPUser –SyncFromAD

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

Posted on Monday, February 27, 2012 9:03 AM SharePoint , Tools , PowerShell | Back to top

Comments on this post: Going from “domain\username” to Display name in SharePoint

# re: Going from “domain\username” to Display name in SharePoint
Requesting Gravatar...
Tried it on my site and it worked great. Thanks for sharing!
Left by Rich on Feb 28, 2012 7:46 AM

# re: Going from “domain\username” to Display name in SharePoint
Requesting Gravatar...
thanks for sharing
Left by Anand on Dec 13, 2012 10:13 AM

comments powered by Disqus

Copyright © Enrique Lima | Powered by: