Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set user account password without knowing the old password in C?

I'm writing a C++ program to manage user accounts on Windows 7.

I would like to set the password for an existing user account.

I cannot use NetUserChangePassword (Netapi32.dll) since I don't record previous password that I set when creating the user.

So, the program must be able to just set a new password (without knowing the old password).

Is there a way to do that programmatically in c++?

Thank you for your help.

like image 467
user1958176 Avatar asked Dec 08 '25 21:12

user1958176


1 Answers

Call NetUserSetInfo with the level parameter set to 1003.

like image 172
Rob Kennedy Avatar answered Dec 10 '25 11:12

Rob Kennedy