wntChgPswd

Changes a user's password.

Syntax:

wntChgPswd(server/domain, user-name, old-password, new-password)

Parameters:

(s) server/domain: either a server name (e.g., "\\MYSERVER") or domain name (e.g., "SALES") on which the password will be changed, or a blank string ("") for the current user's login domain.

(s) user-name: the name of the user whose password will be changed, or a blank string ("") for the current user's login name.

(s) old-password: the user's password on "server/domain" or "*UNKNOWN*" (see below).

(s) new-password :the new password to be set or a blank string ("") to indicate no password is desired.

Returns:

(i) 1

 

old-password

wntChgPswd can be used to specify a new password without knowing the old password, if you are a member of the Administrators or Account Operators local group. To do this, specify "*UNKNOWN*" as the old password. In this case, the "user" parameter must specify an actual user name (ie, it cannot be a blank string).

 

Example:
; Load Appropriate Extender
AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')

old=AskPassword("Change Password","Enter old password") While @TRUE    new1=AskPassword("Change Password","Enter new password")    new2=AskPassword("Change Password","Enter new password again")    If new1==new2 Then Break    Message("Try Again","The new passwords you entered do not match") EndWhile rslt=wntChgPswd("", "", old, new1) If rslt    Message("Password","Successfully changed") Else    Message("Password","Not changed") EndIf Exit