Change windows user password with python

2019-08-11 08:47发布

问题:

I am looking for a way to change the windows password throgh a python script.
somthing like a win32api that can help me?
Thanks!

回答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.