I'm trying to add a list of users from a xls file and I get this error:
Line: 6
Char: 5
Invalid Syntax
The script I'm trying to use looks like this:
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open _
("C:\Scriptt/Users.xls")
intRow = 3
Do Until objExcel.Cells(intRow,1).Value = ""
Set objOU = GetObject("ou=REAL, dc=ormbunken, dc=com")
Set objUser = objOU.Create _
("User", "cn=" & objExcel.Cells(intRow, 2).Value)
objUser.sAMAccountName = objExcel.Cells(intRow, 1).Value
objUser.SetPassword = objExcel.Cells(intRow, 5).Value
objUser.GivenName = objExcel.Cells(intRow, 3).Value
objUser开发者_高级运维.SN = objExcel.Cells(intRow, 4).Value
objUser.AccountDisabled = FALSE
objUser.SetInfo
intRow = intRow + 1
Loop
objExcel.Quit
Does anyone know whats wrong?
Do you need to supply a protocol/server in the GetObject
call? Like what this says
Set oOU = GetObject("LDAP://test.test.cz/ou=skup,dc=test,dc=test,dc=cz")
Set oUser = oOU.Create("User", "cn=" & "Test" & " " & "Tester")
taken from http://msdn.itags.org/iis/2649/
did a google, found http://www.computerperformance.co.uk/vbscript/vbscript_user_spreadsheet.htm
精彩评论