MOTOBIT.COM - ASP upload, IIS utility ChangePassword Method of Server class

Method | Member of  UserManager.Server | Changes | Purchase | Download

Description

Changes password for the currently logged on user.

Syntax

Server.ChangePassword (OldPassword as String, NewPassword as String)
 

Where Type Optional Default Description
 OldPassword  String     Userís old password on the server or domain. 
 NewPassword  String     Userís new password on the server or domain. 

Remarks

There are some differences between UserManager.Server.ChangePassword method and UserManager.User.Password write property.
- ChangePassword method of Server object can call only logged-on user. There is no need to know user name, password for current user is to change. But user must know an old password. Similar like crtl-alt-del -> change password.
- Password write property of User object can call ONLY administrator (or account operator). You do not need to know an old password. Similar like account manager -> set password.

Examples

Change password from an HTML page (directly in IE/CHM/HTA)

Old password : New password :
Source code for this Script:

<form Name=Password>
 Old password : <input Name=OldPassword> 
 New password : <input Name=NewPassword>
 <input type=button onclick="ChangePassword()" Value="Change Password">
</form>

<script language=vbscript>
 Function ChangePassword()
  Set Server = CreateObject("UserManager.Server")
  Server.Select ""
  Server.ChangePassword document.forms.Password.OldPassword.Value, document.forms.Password.NewPassword.Value
  MsgBox "Password was changed to " & document.forms.Password.NewPassword.Value
 End Function
</script>

Change password from an ASP page.

Other links for ChangePassword

Methods of Server class

GetAnyDCName, GetDCName, ChangePassword, LogonUser, RevertToSelf, Select

Properties of Server class

Comment, ComputerName, Domain, Groups, LocalGroups, LoggedOnUser, Name, Servers, Type, Users

UserManager.Server

Properties of servers, enumerating users, logon/logoff to the user administrator account.

UserManager

ActiveX UserManager is easy to use COM component with classes to create, delete and manage local and remote user accounts, groups, servers and domains in the Windows NT (2000/XP) environment. You can simple work with user accounts and groups from VBA, VBS/JS, ASP and T-SQL programming environment.

© 1996 - 2009 Antonin Foller, Motobit Software | About, Contacts | e-mail: info@pstruh.cz