Active Directory Scripting

Associate
Joined
24 Nov 2002
Posts
165
Location
Leicester, UK
Hey Guys, I'm looking for some help with the following issue and I've googled till my eyes bled =/

We use an ASP page (with VBScript) to register users with Active Directory. The Code we are using works fine as a VBScript, and from the asp page when using IIS5, however we have upgraded to IIS6 and we now get a Permission Denied Error. Our investigations suggest this is fairly common after upgrading. We also tried using a COM object and setting it’s permissions to give it full access, all attempts have met with the same error.

The specific part of the code (in whatever form) that is giving this error is:

Code:
oUser.SetPassword sUserPassword

We found that this line was nessacary to correctly set the password, previously we had been using:

Code:
oUser.Put "userPassword", sUserPassword

but it seems that this no longer works properly in Windows 2003 server.

Can you please advise if there is a work around for this problem, we can make more source code available if required.
 
The Full Code is:

Code:
          ' create user with optional info
            Set oOU = lobjUser
            Set oUser = oOU.Create("User", "CN=" & sUserFullName)
            oUser.Put "sAMAccountName", sUserAccountName
            oUser.SetInfo
            oUser.Put "description", sUserDesc
            oUser.Put "givenName", sUserFirstName
            oUser.Put "sn", sUserLastName
            oUser.Put "description", sUserDesc
            oUser.Put "userPrincipalName", sUserUPN & cNamingPrincipal
            oUser.Put "mail", sUserEmail
            oUser.Put "userPassword", sUserPassword
            oUser.Put "pwdLastSet", -1

            oUser.SetInfo

            ' enable account
            oUser.AccountDisabled = True
            oUser.SetInfo
            oUser.AccountDisabled = False
            oUser.SetInfo

            Err.Clear

            oUser.SetPassword sUserPassword
            oUser.SetInfo

And the Error message is:

Code:
            mnldap error '800a0046' 
            Permission denied 
            /./register.asp, line 97
 
Back
Top Bottom