Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '*******************
- '* Script by Alex
- '* Question 2
- '*******************
- On Error Resume Next
- strDestination = "cn=Users,dc=contoso,dc=com"
- set objDestination = GetObject("LDAP://" & strDestination)
- '* Open the file for reading.
- Const ForReading = 1
- Set objectFSO = CreateObject("Scripting.FileSystemObject")
- Set objectTextFile = objFSO.OpenTextFile _
- ("c:\Users\Administrator\Desktop\stufftoadd.txt", ForReading)
- '* First two lines are junk, read and discard
- strJunk = objTextFile.ReadLine
- strJunk = objTextFile.ReadLine
- '* Read the rest of the lines and parse
- '* Each line will have two things: user CN, and their password.
- Do Until objTextFile.AtEndOfStream
- strNextLine = objTextFile.ReadLine
- arrToAdd= Split(strNextLine, ",")
- set objUser = objDestination.Create("user", "cn=" & arrToAdd(0))
- objUser.sAMAccountName = arrToAdd(0)
- objUser.SetPasword arrToAdd(1)
- objUser.AccountDisabled = False
- objUser.setInfo
- Next
- Loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement