无法为本地用户重置密码 [英] Unable to Reset password for the local user

查看:138
本文介绍了无法为本地用户重置密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试更改本地用户帐户密码时,我遇到了com异常.

不允许同一用户使用多个用户名与服务器或共享资源建立多个连接.断开先前与服务器或共享资源的所有连接,然后重试."

when i tried to change my local user account password i am getting com exception.

"Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.."

DirectoryEntry user = new DirectoryEntry(adsPath, machineAndUser,txtOldPassword.Text.Trim(), AuthenticationTypes.Secure);                    //Change Password

user.InvokeSet("SetPassword", new Object[] { txtConfirmPassword.Text });
user.CommitChanges();


catch (System.Runtime.InteropServices.COMException COMex)
{
   if (COMex.ErrorCode == -2147023570 || COMex.ErrorCode == -2147024810      ||COMex.ErrorCode == -2147023677)
{
  MessageBox.Show("Unable to change password due to unknown user name or bad       password\nErr Msg: " + COMex.Message, "CreateUser");
}
}

推荐答案

调用"SetPassword"需要两件事:Kerberos和正确的权限.您必须是管理员才能调用"SetPassword"-如果您考虑一下,这是有道理的.如果将用户的凭据传递到DirectoryEntry并与之绑定,则将与用户的权限绑定,并且我怀疑Adminstrator是其中之一.这也是"ChangePassword"起作用的原因,因为此调用旨在让用户更改自己的密码. "SetPassword"功能更强大,因为它可以覆盖您已有的任何密码策略设置.包括您的DirectoryEntry代码,我也许可以指出其他任何问题.另外,请确保在帖子中包括与LDAP源的确切连接字符串(这有所作为).
Calling ''SetPassword'' needs two things: Kerberos and the correct permissions. You must be an adminstrator to call ''SetPassword'' - which makes sense if you think about it. If you are passing the user''s credentials to the DirectoryEntry and binding with them, you will be binding with the user''s permissions and I doubt Adminstrator is one of them. This would also be why ''ChangePassword'' works, because this call is intended for user''s to change their own password. ''SetPassword'' is much more powerful as it can override any password policy settings you have in place. Include your code for the DirectoryEntry and I might be able to point out any other issues. Also make sure you include your exact connection string to your LDAP source in your post (it makes a difference).


这篇关于无法为本地用户重置密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆