你可以写一个ASP脚本来创建一个修改密码的网页。ASP可以让你完全访问活动目录接口(ADSI),这样你就可以用ASP完成一系列的功能,向修改用户密码或者创建用户帐号。当你写这样一个脚本的时候,你必须考虑这样一个问题---哪些用户可以运行脚本,当脚本运行是你应该使用哪些权限。用来修改用户密码的基本的ADSI命令是:
strUserCN = request.form("cn")
strNewPassword = request.form("newpass")
strPassVerify = request.form("passverify")
if strUserCN="" then
response.write "<html><head><title>Change Password</title></head><body>"
response.write "<center><h1>Web Password Reset</h1></center>"
response.write "<hr>
<form method=post action=changepass.asp><table>"
response.write "<tr><td>CN: </td><td><input type=text name=cn></td><tr>"
response.write "<tr><td>New Password: </td><td><input type=password name=newpass></td></tr>"
response.write "<tr><td>Verify Password: </td><td><input type=password name=passverify></td></tr>"
response.write "<tr><td colspan=2 align=center><input type=submit value='Reset Password'></td></tr>"
response.write "</table></body></html>"
response.end
else
if strNewPassword = strPassVerify then
set usr = GetObject("LDAP://CN=" & strUserCN & ",CN=Users,DC=savilltech,DC=com")
usr.put "userPassword", strNewPassword
response.write "<html><head><title>Results</title></head><center><h1>Update Results</h1></center><hr>
"
response.write strUserCN & ": password was successfully updated"
response.end
else
response.write "<html><head><title>Error!</title></head><body>"
response.write "<center><h1>An Error Has Occurred!</h1></center>"
response.write "<hr>
"
response.write "The password and confirmation do not match. Please go back and try again."
response.end
end if
end if
%>