以编程方式确定当前域控制器
我需要查询当前的域控制器,可能主要是为了更改用户密码。
(P)DC 名称应该是完全限定的,即 DC=pdc,DC=example,DC=com
(如何正确命名此类表示法?)
如何使用 C# 来完成?
I need to query current domain controller, probably primary to change user password.
(P)DC name should be fully qualified, i.e. DC=pdc,DC=example,DC=com
(how to properly name such notation?)
How can it be done using C#?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当
DomainController
存在于您的计算机不属于的域中时,要检索信息,您还需要更多东西。To retrieve the information when the
DomainController
exists in a Domain in which your machine doesn't belong, you need something more.我们在内部应用程序中使用类似的东西。
应该返回类似
DC=d,DC=r,DC=ABC,DC=com
We are using something like this for our internal applications.
Should return something like
DC=d,DC=r,DC=ABC,DC=com
(需要 System.DirectoryServices.AccountManagement.dll):
(requires System.DirectoryServices.AccountManagement.dll):
如果您希望与 Active Directory 进行交互,则不必知道 FSMO 角色占大多数。如果您想从程序中更改 AD 拓扑(我不会),请查看 DomainController 类。
如果要更改用户密码,可以对用户对象调用这些操作,Active Directory 将确保正确复制更改。
复制自 http://www.rootsilver.com/2007 /08/如何更改用户密码
If you are looking to interact the Active Directory, you shouldn't have to know where the FSMO roles are for the most part. If you want to change the AD topology from your program (I wouldn't), look at the DomainController class.
If you want to change a user password, you can invoke those actions on the User object, and Active Directory will make sure that the changes are properly replicated.
copied from http://www.rootsilver.com/2007/08/how-to-change-a-user-password