HOW TO: Customise the style of the display name in Active Directory Users and Computers and the GAL 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 snapin 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=UserDisplay, CN=409, CN=DisplaySpecifiers, CN=Configuration, DC=domainname 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=userdisplay,cn=409,cn=displayspecifiers,cn=configuration,dc=domainname scope base attr createdialog This will provide output like the following example: C:\dev\ad>dsquery * cn=userdisplay,cn=409,cn=displayspecifiers,cn=configuration,dc=r2,dc=testlab,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: viewcreatedialog.vbs Script outputs the value of createdialog; which is an attribute of domainname/configuration/displayspecifiers/409/userdisplay 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=userdisplay,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. viewcreatedialog.vbs Then, from a command prompt (or simply doubleclick if WScript is preferred) run: C:\dev\ad\vbs\>cscript viewcreatedialog.vbs Changing this behaviour To change this behaviour you must modify the createdialog attribute of the UserDisplay display specifier with the attributes that you wish, prefixed with a percent (%) symbol. The UserDisplay display specifier has the following DN: cn=userdisplay, cn=<locale&rt;, cn=displayspecifiers, cn=configuration, dc=<forestroot&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=userDisplay Note. CN=409 is the locale for US English; CN=408 is the locale for UK English. In the righthand pane, Rightclick on CN=userDisplay 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=userdisplay,cn=409,cn=displayspecifiers,cn=configuration,dc=winnetsolutions,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 modcreatedialog.ldf Using VB Script Create an.vbs file with the following contents, changing the locale to your specific locale: modcreatedialog.vbs Script sets the value of createdialog with the value that you enter. createdialog is an attribute of: domainname/configuration/displayspecifiers/409/userdisplay 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=userdisplay,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 UserDisplay","%<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 doubleclick if WScript is preferred) run: C:\dev\ad\vbs\>cscript modcreatedialog.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 snapin. 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: 17092005 Version: 2.0 Last updated: 02082007 Last updated by: Paul Williams