【问题标题】:Problem with my VBS我的 VBS 有问题
【发布时间】:2010-12-09 11:27:48
【问题描述】:

我正在尝试从 xls 文件添加用户列表,但出现此错误:

Line: 6
Char: 5
Invalid Syntax

我尝试使用的脚本如下所示:

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

有谁知道怎么回事?

【问题讨论】:

  • 请阅读我们的常见问题解答,以便您知道要发布到哪个站点。

标签: windows-server-2003 vbscript


【解决方案1】:

您需要在GetObject 调用中提供协议/服务器吗?就像这样说的

Set oOU = GetObject("LDAP://test.test.cz/ou=skup,dc=test,dc=test,dc=cz")
Set oUser = oOU.Create("User", "cn=" & "Test" & " " & "Tester")

取自http://msdn.itags.org/iis/2649/


google了一下,找到http://www.computerperformance.co.uk/vbscript/vbscript_user_spreadsheet.htm

【讨论】:

    猜你喜欢
    • 2013-04-08
    • 1970-01-01
    • 1970-01-01
    • 2016-08-03
    • 2011-03-12
    • 1970-01-01
    • 2011-10-22
    • 2018-05-18
    • 2013-04-04
    相关资源
    最近更新 更多