0

我现在不知所措;我已经用几种不同的方式尝试了这个脚本,但不断收到错误消息There is no such object on the server at character 20,2

这行写着

Set objOU = GetObject("LDAP://ou=users,dc=asp,dc=rippe,dc=com")

当我切换OUCN用户旁边时,我得到一个不同的错误。

所需的最终结果是从 HTML 表单中获取所有变量,然后脚本将运行以在我们的域上创建新用户。

我什至还没有将用户添加到组中,因为我无法克服这个障碍。

Dim strID,StrFName,strLName,strFirm,strPwd,strServer,strLMS,strSql,strLMSV

strID = zademo
strFName = Demo
strLName = Tester
strFirm = Demo
strPwd = za1234
strServer = rkasp01
strLMS = y
strSql = y
strLMSV = y
strDisplay = strLName & ", " & strFName


'Create Citrix User Account

If strSql = y OR strLMSV = y Then

    Set objOU = GetObject("LDAP://ou=Users,dc=asp,dc=rippe,dc=com")

    Set objUser = objOU.Create("User", "cn=" & strDisplay)
    objUser.Put "sAMAccountName", strID
    objUser.Put "Description", strFirm

    objUser.Put "givenName", strFName
    objUser.Put "sn", strLName
    objUser.Put "displayName", strDisplay
    objUser.Put "homedirectory", "\\rkpdc\" & strFirm & "\" & strID
    objUser.Put "scriptpath", strFirm & ".bat"
    objUser.SetInfo

End If

objUser.SetPassword strPwd
objUser.Put "PasswordExpired", CLng(1)
objUser.AccountDisabled = FALSE
objUser.SetInfo
4

3 回答 3

1

设置 objOU = GetObject("LDAP://ou=Users,dc=asp,dc=rippe,dc=com")

通常“用户”是一个容器,而不是一个 OU。

尝试:

设置 objOU = GetObject("LDAP://CN=Users,dc=asp,dc=rippe,dc=com")

于 2012-12-29T18:31:57.507 回答
0

您是否尝试过将 example.com 替换为实际域。

GetObject("LDAP://example.com/OU=Users,DC=asp,DC=rippe,DC=com")
于 2012-12-28T19:18:06.347 回答
0
Option Explicit
Dim strUserName
Dim objRootLDAP
Dim objContainer
Dim objNewUser
strUserName = "MorganTestUser"

Set objRootLDAP = GetObject("LDAP://rootDSE")

' You can give your own OU like LDAP://OU=TestOU instead of LDAP://CN=Users
Set objContainer = GetObject("LDAP://CN=Users," & _
objRootLDAP.Get("defaultNamingContext")) 

Set objNewUser = objContainer.Create("User", "cn=" & strUserName)
objNewUser.Put "sAMAccountName", strUserName
objNewUser.Put "givenName", "Morgan"
objNewUser.Put "sn", "TestUser"
objNewUser.Put "displayName", "Morgan TestUser"
objNewUser.Put "Description", "AD User created by VB Script"
objNewUser.SetInfo

objNewUser.SetPassword "MyPassword123"
objNewUser.Put "PasswordExpired", CLng(1)
objNewUser.AccountDisabled = FALSE

MsgBox ("New Active Directory User created successfully by using VB Script...")

WScript.Quit
于 2013-10-25T15:22:13.587 回答