Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating AD/LDAP user attibutes.

Status
Not open for further replies.

muralisai25

IS-IT--Management
Jul 20, 2002
51
US
Hi,
I am not a adsi/vb developer but i was wondernig if anyone has an example of a script that would do MASS updates to user attributes in AD. The data might possibly come from Oracle view or simple excel file. We have the user id and employee id in the data file. We would like to query AD for that particular user id(from oracle view or excel file) and update the employeeid attribute. Any help wpuld be greatly appreciated.
Thanks
SM
 
Great function for taking the username and returning the LDAP path can be found in K0b3's FAQ faq329-5688.

Once you have the LDAP path you can update an attribute like this:

Code:
Const ADS_PROPERTY_UPDATE = 2 
Set objUser = GetObject _
   ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com") 

objUser.Put "givenName", "Ken"
objUser.Put "initials", "E."
objUser.Put "sn", "Myer"
objUser.Put "displayName", "Myer, Ken"
objUser.Put "physicalDeliveryOfficeName", "Room 4358" 
objUser.Put "telephoneNumber", "(425) 555-1211"
objUser.Put "mail", "myerken@fabrikam.com"
objUser.Put "[URL unfurl="true"]wWWHomePage",[/URL] "[URL unfurl="true"]http://www.fabrikam.com"[/URL]   

objUser.PutEx ADS_PROPERTY_UPDATE, _
    "description", Array("Management staff")
objUser.PutEx ADS_PROPERTY_UPDATE, _
    "otherTelephone", Array("(800) 555-1212", "(425) 555-1213")  
objUser.PutEx ADS_PROPERTY_UPDATE, _
     "url", Array("[URL unfurl="true"]http://www.fabrikam.com/management")[/URL]

objUser.SetInfo

I hope you find this post helpful.

Regards,

Mark
 
Thanks Mark.

I found something similar. I modified it so it reads from an excel file :)

Cheers
SM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top