I am looking for a way to change the windows password throgh a python script.
somthing like a win32api that can help me?
Thanks!
Asked
Active
Viewed 2,876 times
1

Shawn
- 11
- 1
- 5
-
1You first need to fiquere out where the password is stored. Then modify that file, if that is possible. – Tenzin Nov 14 '15 at 20:18
-
What do you mean by "the windows password"? Are you referring to a password on a user account? – MrEricSir Nov 14 '15 at 20:34
-
@Tenzin No, that's not how to do this. The correct way would be with an API function if it existed. – David Heffernan Nov 14 '15 at 20:38
-
@MrEricSir - I'm talking about windows user password. – Shawn Nov 14 '15 at 20:42
-
@DavidHeffernan - Do you know such a function? – Shawn Nov 14 '15 at 20:42
1 Answers
1
You can do this with the Win32 function NetUserChangePassword
. From Python you can access that with win32net.NetUserChangePassword
.
Although as the documentation points out this won't work if you are using active directory. But in that case you are surely not in a position to change user passwords programmatically.

David Heffernan
- 601,492
- 42
- 1,072
- 1,490
-
You could also execute `subprocess.call("net user username newpassword")`. See [net user](https://technet.microsoft.com/en-us/library/cc771865). – Eryk Sun Nov 14 '15 at 22:14