I am writing a script (and by the way not very good with scripts) to
create new users in bulk. The spreadsheet refereenced in the code
below is valid and in the right place. the error I am getting is:
Line 6 Car 5 Invalid syntax Code 800401E4 Source (null)
I have no Idea where the error is, this is the code:

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open _
("C:\New_users.xls")
intRow = 2
Do Until objExcel.Cells(intRow,1).Value = ""
Set objOU = GetObject("ou=Phil, dc=fnfglobal, dc=local")
Set objUser = objOU.Create _
("User", "cn=" & objExcel.Cells(intRow, 15).Value)
objUser.sAMAccountName = objExcel.Cells(intRow, 16).Value
objUser.GivenName = objExcel.Cells(intRow, 10).Value
objUser.SN = objExcel.Cells(intRow, 12).Value
objUser.middleName = objExcel.Cells(intRow, 11).Value
objUser.company = objExcel.Cells(intRow, 1).Value
objUser.street = objExcel.Cells(intRow, 2).Value
'Enter City
objUser.l = objExcel.Cells(intRow, 4).Value
'Enter State
objUser.st = objExcel.Cells(intRow, 5).Value
objUser.postalCode = objExcel.Cells(intRow, 6).Value
objUser.department = objExcel.Cells(intRow, 14).Value
objUser.title = objExcel.Cells(intRow, 13).Value
objUser.AccountDisabled = FALSE
objUser.SetInfo
intRow = intRow + 1
Loop
objExcel.Quit

Any help would really be appreciated....
Phil

Re: Error Invalid Syntax by Richard

Richard
Fri Nov 30 12:50:21 PST 2007

See comment inline below:

"bones" <ssgbones@gmail.com> wrote in message
news:c5ee679d-8a5e-4768-9ac1-e65ae2fd8a6d@p69g2000hsa.googlegroups.com...
>I am writing a script (and by the way not very good with scripts) to
> create new users in bulk. The spreadsheet refereenced in the code
> below is valid and in the right place. the error I am getting is:
> Line 6 Car 5 Invalid syntax Code 800401E4 Source (null)
> I have no Idea where the error is, this is the code:
>
> Set objExcel = CreateObject("Excel.Application")
> Set objWorkbook = objExcel.Workbooks.Open _
> ("C:\New_users.xls")
> intRow = 2
> Do Until objExcel.Cells(intRow,1).Value = ""
> Set objOU = GetObject("ou=Phil, dc=fnfglobal, dc=local")

the "Set objOU" statement appears to be line 6, and your error was raised on
line 6. The binding string is missing the LDAP:// moniker, which accounts
for the invalid syntax error. It should be:

Set objOU = GetObject(LDAP://ou=Phil,dc=fnfglobal,dc=local)

I have not looked at the rest of the code.

> Set objUser = objOU.Create _
> ("User", "cn=" & objExcel.Cells(intRow, 15).Value)
> objUser.sAMAccountName = objExcel.Cells(intRow, 16).Value
> objUser.GivenName = objExcel.Cells(intRow, 10).Value
> objUser.SN = objExcel.Cells(intRow, 12).Value
> objUser.middleName = objExcel.Cells(intRow, 11).Value
> objUser.company = objExcel.Cells(intRow, 1).Value
> objUser.street = objExcel.Cells(intRow, 2).Value
> 'Enter City
> objUser.l = objExcel.Cells(intRow, 4).Value
> 'Enter State
> objUser.st = objExcel.Cells(intRow, 5).Value
> objUser.postalCode = objExcel.Cells(intRow, 6).Value
> objUser.department = objExcel.Cells(intRow, 14).Value
> objUser.title = objExcel.Cells(intRow, 13).Value
> objUser.AccountDisabled = FALSE
> objUser.SetInfo
> intRow = intRow + 1
> Loop
> objExcel.Quit
>

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--