如何以编程方式更改我的 Windows 域密码?
换句话说,如何更改密码而不通过“Ctrl+Alt+Del -> 更改密码”界面。
我所说的以编程方式是指通过命令行工具、通过 .NET 库使用 C#、通过 Python 进行 COM 调用……实际上,任何不涉及任何手动步骤的方式。
NET USER
命令不合格,因为它要求我以域管理员权限运行。
In other words, how to change my password without going through the "Ctrl+Alt+Del -> Change Password" interface.
By programmatically I mean via a command-line tool, C# via a .NET library, COM-invocation via Python, ... Whatever doesn't involve any manual steps, really.
The NET USER
command is ineligible, as it requires me to run with domain administrator privileges.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 DirectoryEntry 类来获取和更新用户的活动目录条目。
http://linuxonly.nl/docs/21/43_Circumvent_password_expiry_in_Windows.html
Use the DirectoryEntry class to get and update the active directory entry for the user.
http://linuxonly.nl/docs/21/43_Circumvent_password_expiry_in_Windows.html
下面是 Sjoerd 提供的代码的修改版本,该代码更改一次密码,而不是循环多次更改密码。
Here is a modified version of the code Sjoerd provided that changes the password once rather than cycling through multiple password changes.