Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to change password of a local user account

21 views
Skip to first unread message

xiaohang zhu

unread,
Sep 16, 2002, 7:24:59 PM9/16/02
to
Hi, everybody
What API can change a local user account password? I know there is
an API called "NetUserChangePassword". But that API seems can only
change user account password at SERVER or DOMAIN, will that API also
work on local user account? Are these "NetUser*" APIs only for server
or domain? Is there a set of APIs for local user account? Need your
help.

Thanks

Jerry

Klaus H. Probst

unread,
Sep 16, 2002, 11:36:03 PM9/16/02
to
It should work all the same - just pass the local domain (i.e., the
qualified computer name) when calling the API.
Otherwise the API will assume the logon domain, which is probably the
domain.

And, unless I'm missing something, "SERVER" is the local domain.


--
. . . . . . . . . . . . . . . . . . . . . .
Klaus H. Probst, MVP
http://www.vbbox.com/


Please post/reply to the newsgroup(s)


"xiaohang zhu" <zhuxi...@hotmail.com> wrote in message
news:5e7343af.02091...@posting.google.com...

Rob (Gunner)

unread,
Sep 17, 2002, 12:04:57 AM9/17/02
to
"Klaus H. Probst" <kprobst@v bbox].com> wrote in news:eU8otsfXCHA.3764
@tkmsftngp08:

Just pass NULL to the domainname parameter:

NET_API_STATUS NetUserChangePassword(
LPCWSTR domainname,
LPCWSTR username,
LPCWSTR oldpassword,
LPCWSTR newpassword
);

Parameters
domainname
[in] Pointer to a constant string that specifies the DNS or NetBIOS name
of a remote server or domain on which the function is to execute. If this
parameter is NULL, the logon domain of the caller is used.
Windows NT 4.0 and earlier: This string must begin with \\.

username
[in] Pointer to a constant string that specifies a user name. The
NetUserChangePassword function changes the password for the specified
user.
If this parameter is NULL, the logon name of the caller is used. For more
information, see the following Remarks section.

oldpassword
[in] Pointer to a constant string that specifies the user's old password.

newpassword
[in] Pointer to a constant string that specifies the user's new password.


Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Unsupported.
Header: Declared in Lmaccess.h; include Lm.h.
Library: Use Netapi32.lib.


For Win 95/98/ME you have to use PwdChangePassword
--
~Rob (Gunner)
IE Zone Editor
Gunner's RiFLE
http://www.gunner-inc.com

Elan Zhou(MS)

unread,
Sep 17, 2002, 10:48:04 PM9/17/02
to
Hi,

You can check the following article for more information about changing
password:
HOWTO: Change Passwords Programmatically in Windows NT/2000/XP
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q151546

Regards,
Elan Zhou
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net? http://www.gotdotnet.com

0 new messages