Use ASP to change the NT user password

Source: Internet
Author: User

<HTML>
<Title>
Change NT user password
</Title>
<Body>
<%
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 color = Red> <B> the password has been modified!
</B> <br>"
Response. Write "</font>"
Else
Objcontext. setabort
Response. Write "<font
Color = Red> <B> incorrect old password. Please enter the correct old password again! </B> <br> "& errmsg
Response. Write "</font>"
End if
Set adsuser = nothing
End sub

Response. Write "<center> <H2> change NT user password </H2> </center>"
Computer = "penguinliang"
Username = "Administrator"
Oldpassword = "loving"
Newpassword = "loved"
Changeuserpassword
Computer, username, oldpassword, newpassword
%>
</Body>
</Html>

The name and password of the computer are in the subsequent code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.