Script to populate active directory

sasco

Distinguished
Aug 5, 2010
1
0
18,510
I'd like a script to populate Department field of the AD with student year of entry. Can anyone help please?
Thank
Sasco
 

luiscloss

Distinguished
Jul 21, 2010
24
0
18,520
This is very usefull:

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 "wWWHomePage", "http://www.fabrikam.com"

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("http://www.fabrikam.com/management")

objUser.SetInfo


Whatever you want about scripts, there is not better than the ScriptCenter. You may find it on TechNet. If you don´t send me some comments or email and I can send it over to you. It is a .chm file with lots of scripts.

Since you are talking about STUDENTS, this may be very, very usefull:

Set objUser = GetObject _
("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")
objUser.AccountExpirationDate = "03/30/2003"
objUser.SetInfo


This is to set automatically their EXPIRATION DATE BASED ON YOUR NEEDS.

Luis Closs