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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

modify LDAP users

Status
Not open for further replies.

taoist

Programmer
Joined
Feb 1, 2006
Messages
35
Location
US
I need to modify existing LDAP users passwords
Is there a way to do this. Right now the code creates the users. Is there a way to modify users?

onst ForReading = 1
Set objShell = WScript.CreateObject ("WScript.Shell")
Set objFSO = CreateObject ("Scripting.FileSystemObject")
Set fileObject = objFSO.OpenTextFile("C:\VB\File.txt", ForReading)

Do While Not fileObject.AtEndOfStream
strLine = fileObject.ReadLine

aArray = Split(strLine, ",")

sUser = aArray(0)
sPassword = aArray(1)

Dim oContainer
Dim oUser
Set oContainer=GetObject("LDAP://OU=Student,DC=MYCSU,DC=ces,DC=edu")
'Create user
Set oUser = oContainer.Create("User","CN=" & sUser)
'Assign values to user attributes
oUser.Put "samAccountName", sUser
oUser.SetInfo
oUser.SetPassword sPassword
oUser.SetInfo
oUser.AccountDisabled = False
oUser.SetInfo
'Clean up
Set oUser = Nothing
Set oContainer = Nothing
WScript.Echo "Finished"
'WScript.Quit
Loop
 
is it me or am i going mad???

Set oContainer=GetObject("LDAP://OU=Student,DC=MYCSU,DC=ces,DC=edu")
'Create user
On error Resume Next
Set oUser = oContainer.Create("User","CN=" & sUser)
If Err.Number <> 0 Then
Set oUser = GetObject("LDAP://" & "CN=" & sUser & ",OU=Student,DC=MYCSU,DC=ces,DC=edu")
End If
 
something is wrong on my end. for some reason I create my account. it gets locked or something or removed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top