Re: User property vbscript
- From: "nntp.aioe.org" <x@xxxxxxxxxxxxx>
- Date: Mon, 10 Sep 2007 21:16:27 -0400
Doh! Nevermind,
objitem.setinfo
....is what I was missing!
Thanks for reading this anyway.
nntp.aioe.org wrote:
P.S. I also tried this technique (everything between the stars):.
***********************************
Const ADS_PROPERTY_UPDATE = 2
Set colItems = GetObject _
("LDAP://ou=test,DC=company1,DC=local")
colItems.Filter = Array("user")
For Each objItem in colItems
objitem.put "displayname", objitem.givenname _
& " " & objitem.sn & " (Company1)"
Next
***********************************
The above script runs without errors, but the problem is it doesn't modify anything.
nntp.aioe.org wrote:I'm trying to script the display field of all user objects in an OU. The goal of the script is to take the user first name, insert a space, take the user last name, insert a space, and then quote custom text.
For example: The user Firstname is David and his Lastname is Consumer and the text to append is (Company1). His display name should look like this:
David Consumer (Company1)
The script I've pieced together does everything well except when I try to enumerate the "sn" schema property of the user object it states that the object could not be found in the schema cache.
Here is the code so far (everything between the stars):
*******************************
Const ADS_PROPERTY_UPDATE = 2
Set OU = GetObject _
("LDAP://OU=test,DC=company1,DC=local")
For Each objUser In OU
If objUser.Class = "user" Then
objUser.Put "displayname", objUser.Get("givenname") _
& " " & objUser.Get("sn") & " " & "(Company1)"
objUser.SetInfo
End If
Next
*******************************
The ldap bind is successful, the retrieval of the givenname property is successful, but when it comes to the surname ("sn") property it states that it doesn't exist. I fire up adsiedit.msc to confirm that the field exists and sure enough it does.
Anyone want to take a stab at what I might be doing wrong?
(Just a side note, If I rewrite the script and target a specific user and wscript.echo the "sn" property it returns it just fine).
- References:
- User property vbscript
- From: nntp.aioe.org
- Re: User property vbscript
- From: nntp.aioe.org
- User property vbscript
- Prev by Date: Re: User property vbscript
- Next by Date: Re: Default Domain Policy - Password Chg 90 days
- Previous by thread: Re: User property vbscript
- Index(es):
Relevant Pages
|