EN 
30.11.2025 Ondřej WELCOME IN MY WORLD

This website is originally written in the Czech language. Most content is machine (AI) translated into English. The translation may not be exact and may contain errors.

Tento článek si můžete zobrazit v originální české verzi. You can view this article in the original Czech version.
Rozšíření Active Directory Users And Computers o editaci employeeID

Active Directory Users And Computers extension to edit employeeID

Edited 03.12.2007 14:25 | created | Petr Bouška - Samuraj |
This article discusses a relatively simple procedure for extending the Active Directory Users And Computers administrative tool to edit an additional attribute. This is an attribute that is part of the AD schema but is not supported in ADUC. The example shows the employeeID attribute, but it can be similarly applied to any other attribute. In the first step, a VB script is created that accesses the value. In the second step, the ADUC context menu is expanded.
displayed: 27 121x (25 651 CZ, 1 470 EN) | Comments [0]

Note: This solution is not a novelty, and you can find a number of English tutorials on the internet, I have only added a Czech version.

The Active Directory directory contains a wide range of attributes, some of which were added from the Windows Server 2003 version. AD is compatible with the LDAP directory and therefore contains various attributes defined for LDAP, which, however, it does not use as standard. Using the Snap-In to the MMC console Active Directory Users And Computers (hereinafter referred to as ADUC), we can display and edit only some attributes.

To access all attributes, we can use a tool (such as ldp.exe) or a programming language that uses the LDAP protocol. Or we can use the MS tool ADSIEdit, which is located in the Windows Server 2000/2003 Support Tools (for example, Windows Server 2003 Service Pack 2 32-bit Support Tools).

The ADUC component, however, can be edited and extended by ourselves. One option is to edit the library, an example is Additional Account Info directly from MS (part of the Windows 2003 Server Resource Kit, the library must be registered - regsvr32 acctinfo.dll), but it is not that simple. The second option is to use a Visual Basic script, which we run from the ADUC context menu.

The following example shows how to create a script to display and edit the employeeID attribute (employee number). And how to extend the User object context menu so that this script can be run.

Creating a script for the employeeID attribute

First, we need to create a simple VB script that will do all the work of reading, displaying, and writing values from/to AD. This is just a simpler example that could be extended and supplemented with some checks.

Set wshArgs = Wscript.Arguments
Set objAD = GetObject(wshArgs(0))
eID = objAD.employeeID
if eID = "" then eID = "empty"
res = InputBox("Person: " & objAD.cn & vbCrLf & vbCrLf & "Current employee number: " & eID & vbCrLf & vbCrLf & "Enter new employee number:", objAD.cn & " employee number", objAD.employeeID)
if res <> "" then
  Err.Clear
  objAD.EmployeeID = res
  objAD.setinfo
  if Err Then MsgBox "Employee number could not be saved.", vbCritical, "Error !!!"
end if

Save this script, for example, as employeeID.vbs and place it in a location accessible to everyone who will need it. The context menu modification applies to the domain, so anyone who accesses this value through ADUC must have access to the script. A suitable place to store the script is the NETLOGON directory on the domain controller.

Popup okno pro zadávání

Adding an item to the context menu

  1. Run ADSIEdit.msc with the necessary permissions (Domain Admin or Enterprise Admin depending on the structure)
  2. Open Configuration, then our domain and CN=DisplaySpecifiers
  3. Depending on the language, select the next folder, CN=409 for English, CN=405 for Czech
  4. Here we will find the item CN=user-Display and open it by double-clicking
    (so the full DN record is CN=user-Display,CN=409,CN=DisplaySpecifiers,CN=Configuration,DC=domain,DC=tld)
  5. The first attribute in the list should be adminContextMenu, open it by double-clicking
  6. Now we will create an item in the user context menu, the first value we will enter is some free number, the second is the name of the item in the context menu, and the last is the path to the script that will run
    Example: 6,&Employee number,\\domain-server\netlogon\employeeID.vbs
ADSI Edit user-Display
ADSI Edit user-Display editace
ADSI Edit adminContextMenu

Interesting links

Author:

Related articles:

Active Directory and the LDAP protocol

Managing a corporate computer network using Microsoft OS usually means managing Active Directory Domain Services (AD DS). It is a very extensive group of technologies, protocols and services. The basis is directory services, authentication and the LDAP communication protocol.

If you want write something about this article use comments.

Comments

There are no comments yet.

Add comment

Insert tag: strong em link

Help:
  • maximum length of comment is 2000 characters
  • HTML tags are not allowed (they will be removed), you can use only the special tags listed above the input field
  • new line (ENTER) ends paragraph and start new one
  • when you respond to a comment, put the original comment number in squar brackets at the beginning of the paragraph (line)