Home
HOW TO: Customise the style of the display name in Active Directory Users and Computers and the GAL Print E-mail

Finding and Modifying the Display Specifier - createDialog

It is often asked how the Display Name for user and contact objects in the Active Directory (GUI) management tools (and the GAL) can be changed from the default of to something else, perhaps , , so that this happens by default. This article explains how to make the necessary changes to achieve this.

Default behaviour

When creating user and contact objects in the Active Directory Users and Computers (DSA.MSC) management snap-in the default behaviour of the create new < object > dialog is to populate the displayName attribute with the givenName attribute, a space, and then the sn attribute.

Note. Please refer to the final section of this article for a brief mapping of the GUI field names to the LDAP attribute names.

Discovering the current setting

The value that defines this behaviour is defined in the attribute createDialog of the object:

CN=User-Display, CN=409, CN=DisplaySpecifiers, CN=Configuration, DC=domain-name

This can be viewed using ADSIEdit.msc or LDP. You can also query this attribute using DSQUERY or ADSI.

Using DSQUERY

Type the following command into a command prompt on a domain member as a user with read permissions in the Configuration container.

C:\dev\ad>dsquery * cn=user-Display,cn=409,cn=displaySpecifiers,cn=configuration,dc=domain-name -scope base -attr createDialog

This will provide output like the following example:

C:\dev\ad>dsquery * cn=user-Display,cn=409,cn=displaySpecifiers,cn=configuration,dc=r2,dc=test-lab,dc=com -scope base -attr createDialog
createDialog
%, %

Using VB Script

  • Create an .VBS file with the following contents, changing the locale to your specific locale:
  • ' view-createDialog.vbs
    '
    ' Script outputs the value of createDialog; which is an attribute
    ' of domain-name/configuration/DisplaySpecifiers/409/user-Display
    '
    ' This attribute defines the default display name syntax, e.g.
    ' "Smith, John" or "Jane Doe"
    '
    ' Paul Williams, msresource.net, Jan 2004
    '
    Option explicit dim oRootDse,oBase
    dim sCreateDialog set oRootDse=GetObject("LDAP://RootDSE")
    set oBase=GetObject("LDAP://cn=User-Display,cn=409,"&_
    "cn=DisplaySpecifiers,"&oRootDse.get("configurationNamingContext")) on error resume next sCreateDialog=oBase.get("createDialog") if(sCreateDialog="")then
    wscript.echo"Value not set. Default value is % %"
    else
    wscript.echo"Value set to "&sCreateDialog
    end if

  • Save the file as .vbs, e.g. view-createDialog.vbs
  • Then, from a command prompt (or simply double-click if WScript is preferred) run:
  • C:\dev\ad\vbs\>cscript view-createDialog.vbs 

Changing this behaviour

To change this behaviour you must modify the createDialog attribute of the User-Display display specifier with the attributes that you wish, prefixed with a percent (%) symbol. The User-Display display specifier has the following DN:

cn=user-Display, cn=<locale&rt;, cn=DisplaySpecifiers, cn=Configuration, dc=<forest-root&rt;, dc=<1st level suffix>

Note. For clarity of reading, and manageability of text layout on the screen, the DN includes spaces after each separator (comma); this in not the case when writing a DN in script, query or code.

Using the GUI

The easiest way of making this change is using the GUI tool ADSIEdit.msc, which is a Windows Support Tool.

Note. For more information on the Windows Support Tools, information on how to obtain and install them, as well as information on what tools are included in the different versions, please refer to the following msresource.net knowledgebase article:
-- INFO: The Windows Server Support & Resource Kit Tools

  • To do this, load ADSIEdit.msc by typing ADSIEdit.msc at the Run command
  • In ADSIEdit.msc, expand the Configuration container, and then expand each of the following in turn - CN=Configuration, CN=DisplaySpecifiers, CN=, where is your locale.
  • Select CN=user-Display
  • Note. CN=409 is the locale for US English; CN=408 is the locale for UK English.

  • In the right-hand pane, Right-click on CN=user-Display and choose properties
  • Find and edit the createDialog attribute with the value you wish the new default to be

Examples

There are very few possibilities for this attribute, as only givenName, sn and initial can be used (as these are the only attributes that are guaranteed to be available at the time of creation as they are defined in the same form). The following are some examples of what you might enter.

createDialog attribute Value

Display Name/ cn value example
%, % Williams, Paul
%, % % Hambling, Emma L
% % %
David L Murphy


Other ways of changing this attribute

There are obviously several other ways of modifying this attribute, for example LDP, LDIFDE, VB Script, ADMOD, .NET code, etc.

Two such examples are an LDIF file (for use with LDIFDE) and a script (written in VB Script). They are as follows.

Using LDIFDE

  • Create an .LDF file with the following contents, changing the locale and domain name to your configuration

  • dn: cn=user-Display,cn=409,cn=DisplaySpecifiers,cn=Configuration,dc=winnet-solutions,dc=com
    changetype: modify
    replace: createDialog
    createDialog: %<sn&rt;, %<givenname&rt; %<initial&rt;
    -

  • Save the file as <file name&rt;.ldf
  • Then, from a command prompt run:
  • C:\dev\ad\ldif\>ldifde -i -f mod-createDialog.ldf

Using VB Script

  • Create an .VBS file with the following contents, changing the locale to your specific locale:
  • ' mod-createDialog.vbs
    '
    ' Script sets the value of createDialog with the value that you
    ' enter. createDialog is an attribute of:
    ' -- domain-name/configuration/DisplaySpecifiers/409/user-Display
    '
    ' This attribute defines the default display name syntax, e.g.
    ' "Smith, John" or "Jane Doe"
    '
    ' Paul Williams, msresource.net, Jan 2004
    '
    Option explicit dim oRootDse,oBase
    dim sDefaultDisplayNameConfiguration set oRootDse=GetObject("LDAP://RootDSE")
    set oBase=GetObject("LDAP://cn=User-Display,cn=409,"&_
    "cn=DisplaySpecifiers,"&oRootDse.get("configurationNamingContext")) sDefaultDisplayNameConfiguration=InputBox("Please enter a new value for "&_
    "the default displayName."&vbCrLf&vbCrLf&"For example, enter:"&vbCrLf&_
    vbTab&"%, % %"&vbCrLf&vbCrLf&" To have a "&_
    "default display name of: Smith, John F. "&vbCrLf,"Enter new value "&_
    "for User-Display","%<sn&rt;, %<givenname&rt;")
    if(sDefaultDisplayNameConfiguration<>"")then
    oBase.put"createDialog",sDefaultDisplayNameConfiguration
    obase.setInfo
    wscript.echo"Set the default display name to the following "&_
    "syntax: "&sDefaultDisplayNameConfiguration&"."
    else
    wscript.echo"No input received. Doing nothing."
    end if wscript.echo"Script finished."

  • Save the file as .vbs
  • Then, from a command prompt (or simply double-click if WScript is preferred) run:

  • C:\dev\ad\vbs\>cscript mod-createDialog.vbs

    LDAP display name to GUI label name mappings

    This article has mentioned a number of user object attributes, and has used the LDAP display names when referring to these attributes. The following table simply maps the LDAP display names of the attributes to the Text Labels used in the Active Directory Users and Computers management snap-in.

    GUI Text Field/ Display Name

    LDAP Display Name
    First Name givenName
    Initials initial
    Surname sn
    Description description
    Full Name cn
    Display Name displayName
    Pre Windows 2000 User Name sAMAccountName
    User name userPrincipalName
    .

    Document information

    Author: Paul Williams
    Written: 17-09-2005
    Version: 2.0
    Last updated: 02-08-2007
    Last updated by: Paul Williams




Del.icio.us!Technorati!StumbleUpon!Furl!
 
< Prev   Next >