Change Password of a local windows user

 ̄綄美尐妖づ 提交于 2019-12-01 07:32:32

SetPassword requires admin rights to execute - which is not something you probably want to do. ChangePassword does not and can be used by the end user themselves. It takes the old password and new password as arguments. This would be the preferred way of executing this and it would also verify their identity.

Wolfish

You could theoretically use a workaround by using the WinNT provider to instantiate the DirectoryEntry object, enabling the user to change passwords without supplying domain admin rights. You might also consider the code posted here, using an encrypted database to store admin credentials.

This is a risky move, perhaps, depending on the nature of your storage (you could use a hash of the MAC address of the machine as a password maybe?), but I'm not sure there is another method of doing this. As far as I'm aware, the answer supplied by eMi wouldn't work without an authenticated instance of DirectoryEntry, although I could be wrong.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!