locked
Change User password in active directory on windows server 2003 using asp. RRS feed

  • Question

  • Hi All,

    Earlier my web server & domain controller (Windows 2000 server) was same at that time below script was running fine to change the user password in active directory.
    Now the web server is upgraded to Windows server 2003 and separate Domain Controller(Windows server 2003) is there. To run the same script I replaced Line number 9 by sConnectString = "WINDOWS://dc1auth/" & sUser & ",user" but now this script is not is running. It is showing error at line number 10 always( syntax error)

    Any body help me please...............
    1. <%@ Language=VBScript %>
    2. <%
    3. dim sUser, sPassword
    4. dim oUser, sConnectString
    5. sUser = request("txtUserName")
    6. sPassword = request("txtPassword")
    7.  sNewPassword = request("txtNewPassword")
    8. if sUser = "" then Response.Redirect "ChangePassword.asp"
    9. sConnectString = "WinNT://dc1auth/" & sUser & ",user"
    10. Set oUser = GetObject(sConnectString)
    11. oUser.ChangePassword sPassword, sNewPassword
    12. If (Err.Number<>0) Then
    13. err_number = Hex(Err.Number)
    14. If err_number = "8007005" Then
    15. err_text = "Your Account is locked out."
    16. elseIf err_number = "80070056" Then
    17.  err_text = "Invalid Old NT Password."
    18. elseIf err_number = "800708AD" Then
    19. err_text = "The specIfied NT Account does not exist."
    20. elseIf err_number = "800708C5" Then
    21. err_text = "Your new password cannot be the same as any of your previous passwords."
    22. else err_text = "An error has occured "
    23.  End If %>
    24. <%= err_text%>
    25.  <%
    26.  Response.end
    27. End If
    28. set oUser = Nothing
    29.  %>
    30. The password has been updated for user <%=sUser%>. Click here to go back to the home page.
    Thursday, March 26, 2009 4:25 AM