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 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