首页 | 社区 | 博客 | 招聘 | 文章 | 新闻 | 下载 | 读书 | 代码
亲,您未登录哦! 登录 | 注册

用ASP修改NT登陆密码

打印文章

分享到:
<%
Sub ChangeUserPassword(Computer,UserName,oldPassword,newPassword)
Dim adsUser,foundErr,ErrMsg
On Error Resume Next
foundErr=False
ErrMsg=""
Set adsUser=GetObject("WinNT://"+Computer+"/"+UserName+",user")
If Err.Number<>0 Then
foundErr=True
ErrMsg="User not found!"
Err.Clear
Else
adsUser.ChangePassword oldPassword, newPassword
adsUser.SetInfo
If Err.Number<>0 Then
foundErr=True
ErrMsg=Now & ". Error Code: " & Hex(Err) & " - " & Err.Description & "<br>"
Err.Clear
End If
End If
If Not foundErr Then
objContext.SetComplete
Response.Write "<font class=""A2"" size=""2"" face=""Arial"">Password changed successful!
<br><br>"
Response.Write "<input type=""button"" class=""A1"" name=""b2"" value="" Back ""
onclick=""window.location.replace('default.asp');"">"
Response.Write ""
Else
objContext.SetAbort
Response.Write "<font class=""A2"" size=""2"" face=""Arial"">Wrong old password, back to  
reinput!<br><br>"&ErrMsg
Response.Write "<input type=""button"" class=""A1"" name=""b2"" value="" Back ""
onclick=""history.back();"">"
Response.Write ""
End If
Set adsUser=Nothing
End Sub  

response.write "NT的密码改为qian!"
Computer="yp"
UserName="sky"
oldPassword="dir"
newPassword="qian"
ChangeUserPassword Computer,UserName,oldPassword,newPassword
%>

本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( Pfan.cn )

编程爱好者论坛

本栏最新文章