SharePoint 2010: Remove Domain name from Username Display

Problem

In this posting, you will be shown how to easily and quickly resolve a user identity appearing in the form "[domain name]\username" rather than "[Full Name]".  You will  also be shown how to do this for all users of a web application.

This is a common problem that you'll frequently see in SharePoint 2010.  For example, if the domain was ALSTECHTIPS, in SharePoint 2010, and you were logged into the farm under an administrator account, you would see displayed as ALSTECHTIPS\Administrator, like that shown below:

    

This can become problematic when configuring views to conserve limited width, as the addition of the domain in the username display may add considerably to the column width needed:

One way to address this is to configure user profile synchronization, and this is the best way as it automates resolution of this issue.  See the References for links to helpful articles on how to implement this approach.  However, this approach may not always be desirable or even feasible in some environments.  A much simpler spot approach is to use PowerShell.

Using PowerShell commandlets, you can resolve this for one user or a bunch of users at one time.  Let's get started.

Solution

  1. Open the SharePoint 2010 Management Shell as Administrator.

  2. Enter the command in the format:

    Set-SPUser -Identity '[domain name]\username]' -DisplayName '[full name]' -Web [url]

  3. After the command completes, a new command prompt is display (no messages).

  4. To verify whether the command worked, just refresh your page:

    and

  5. To update the display name for all users, you need to first get the SPUser object associated with your website, and then port the results into the Set-SPUser commandlet, like so:

    Get-SPUser –Web [url] | Set-SPUser –SyncFromAD

  6. Running this command will generate a number of errors appearing in the command shell.  These result from the command attempting to synchronize ALL accounts, including such accounts as System, Local Service, etc, which obviously won't work:

    Ignore these errors: it worked on the others

Summary

In this article, you were shown how to easily and quickly resolve a user identity appearing in the form "[domain name]\username" rather than "[Full Name]".  You were also shown how to do this for all users of a web application.

References