Change in Description

W

WooYing

Hey AD Experts


I was wondering what would be the best way to add a
change to everyone AD description field. Currently I have users who has
their Last Name, First Name ( Division Name). I want to change the Divison
Name to another name (Corp Name). I was wondering what is the best way to
actually do this, any help is appreciated. TIA.
 
R

Richard Mueller

WooYing said:
I was wondering what would be the best way to add a
change to everyone AD description field. Currently I have users who has
their Last Name, First Name ( Division Name). I want to change the
Divison Name to another name (Corp Name). I was wondering what is the
best way to actually do this, any help is appreciated. TIA.

A VBScript program can do this, but you need a source for the values (first
name, last name, etc.) If the sn and givenName attributes are populated in
AD, you can use that. Otherwise you will need to code a program to read
these values from a text file, csv, or spreadsheet. Or perhaps you can parse
the values from the Common name, or even the old description.

You can either enumerate and modify the users in a container, as I do in the
example below, or use ADO to retrieve info on all users in the domain. If
all users are in one OU/container, and the sn and givenName attributes are
populated for all, you can use code similar to:
==========
Option Explicit
Dim objOU, objUser, strFirst, strLast, strDescr

' Bind to OU/container, using Distinguished Name.
Set objOU = GetObject("LDAP://ou=Sales,dc=MyDomain,dc=com")

' Filter on user objects.
objOU.Filter = Array("user")

' Enumerate user objects.
For Each objUser In objOU
' Retrieve attribute values.
strFirst = objUser.givenName
strLast = objUser.sn
' Construct new value for description.
strDescr = strLast & ", " & strFirst & " (Corp Name)"
' Assign value to description attribute.
objUser.description = strDescr
' Save changes.
objUser.SetInfo
Next
============
Otherwise, you can use ADO to retrieve the values of attributes for all
users in the domain. You would also retrieve the distinguishedName of each
user, so you can bind to the user object and modify the description
attribute. For information on using ADO, see this link:

http://www.rlmueller.net/ADOSearchTips.htm
 
J

Joe Richards [MVP]

You may want to look at AdFind/AdMod if you don't want to write a script
to do this.

Specifically check out the AdMod CSV usage via admod /csv? specifically
you want to look at the replace modifier (r) functionality of the
expansion capability.

joe



--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net


---O'Reilly Active Directory Third Edition now available---

http://www.joeware.net/win/ad3e.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top