0

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?

1
  • Please read our FAQ so that you know what to post to which site. Commented Dec 9, 2010 at 11:32

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.