|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
i (thought) i'd figured this out, but i'm getting an error of "Microsoft VBScript compilation error '800a03ee" on the following code. can anyone help? i'm not seeing the syntax errors...
<% @language="VBSCRIPT" %> <% Const ADS_UF_SCRIPT = &H1 Const ADS_UF_ACCOUNTDISABLE = &H2 Const ADS_UF_HOMEDIR_REQUIRED = &H8 Const ADS_UF_LOCKOUT = &H10 Const ADS_UF_PASSWD_NOTREQD = &H20 Const ADS_UF_PASSWD_CANT_CHANGE = &H40 Const ADS_UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED = &H80 Const ADS_UF_TEMP_DUPLICATE_ACCOUNT = &H100 Const ADS_UF_NORMAL_ACCOUNT = &H200 Const ADS_UF_INTERDOMAIN_TRUST_ACCOUNT = &H800 Const ADS_UF_WORKSTATION_TRUST_ACCOUNT = &H1000 Const ADS_UF_SERVER_TRUST_ACCOUNT = &H2000 Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000 Const ADS_UF_MNS_LOGON_ACCOUNT = &H20000 Const ADS_UF_SMARTCARD_REQUIRED = &H40000 Const ADS_UF_TRUSTED_FOR_DELEGATION = &H80000 Const ADS_UF_NOT_DELEGATED = &H100000 Const ADS_UF_USE_DES_KEY_ONLY = &H200000 Const ADS_UF_DONT_REQUIRE_PREAUTH = &H400000 Const ADS_UF_PASSWORD_EXPIRED = &H800000 Const ADS_UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION = &H1000000 Public Sub CreateUser(strUserName As String, strSAMAccountName As String, strPassword As String) Dim objMACwifi As IADs Dim objUsers As IADsContainer Dim objNewUser As IADsUser On Error Resume Next ' Bind to the rootDSE object. Set objMACwifi = GetObject("LDAP://DC=iig1,DC=com") If (Err.Number <> 0) Then Exit Sub End If ' Bind to the Users folder in the domain. Set objUsers = GetObject("LDAP://CN=DevSite,CN=SiteRoot" & objMACwifi.Get("defaultNamingContext")) If (Err.Number <> 0) Then Exit Sub End If ' Create the user object. Set objNewUser = objUsers.Create("user", "CN=" + strUserName) If (Err.Number <> 0) Then Exit Sub End If ' Set the sAMAccountName property. objNewUser.Put "sAMAccountName", strSAMAccountName If (Err.Number <> 0) Then Exit Sub End If ' Commit the new user. objNewUser.SetInfo If (Err.Number <> 0) Then Exit Sub End If ' Set the initial password. This must be performed after ' SetInfo is called because the user object must ' already exist on the server. objNewUser.SetPassword strPassword If (Err.Number <> 0) Then Exit Sub End If ' To enable the user account, remove the ' ADS_UF_ACCOUNTDISABLE flag from the userAccountControl ' property. Also, remove the ADS_UF_PASSWD_NOTREQD and ' ADS_UF_DONT_EXPIRE_PASSWD flags from the ' userAccountControl property. userActCtrl = objNewUser.Get("userAccountControl") objNewUser.Put "userAccountControl", userActCtrl If (Err.Number <> 0) Then Exit Sub End If ' Commit the updated properties. objNewUser.SetInfo End Sub Response.Redirect("http://www.thedionysian.com") %> |
|
#2
|
|||
|
|||
|
What line of code is causing the error?
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > newbie needs help with adding user to active directory |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|