Modifying an Object

Using a graphical user interface

  1. Open ADSI Edit.
  2. If an entry for the naming context you want to browse is not already displayed, do the following:
  3. Right-click on ADSI Edit in the right pane and click Connect to….
  4. Fill in the information for the naming context, container, or OU you want to add an object to. Click on the Advanced button if you need to enter alternate credentials.
  5. In the left pane, browse to the container or OU that contains the object you want to modify. Once you’ve found the object, right-click on it and select Properties.
  6. Edit the sn attribute.
  7. Enter Smith and click OK.
  8. Click Apply.

If the parent container of the object you want to modify has a lot of objects in it, you may want to add a new connection for the DN of the target object. This will be easier than trying to hunt through a container full of objects. You can do this by right-clicking ADSI Edit and selecting Connect to…. Under Connection Point, select Distinguished Name and enter the DN of the object.

Using a command-line interface

Create an LDIF file called modify_object.ldf with the following contents:

dn: cn=jsmith,cn=users,dc=rallencorp,dc=com

 changetype: modify

 add: sn

 sn: Smith

 -

Then run the following command:

> ldifde -v -i -f modify_object.ldf

You can modify a limited number of object types with the dsmod command. Run dsmod /? from a command line for more details.

Using VBScript

strObjectDN = "cn=jsmith,cn=users,dc=rallencorp,dc=com"

 set objUser = GetObject("LDAP://" & strObjectDN)

 objUser.Put "sn", "Smith"

 objUser.SetInfo