获取可用域的列表(NT4 和 Active Directory)
有谁知道(在c#中)获取可用NT4域的方法(有点像WinXP登录框下拉菜单)?
我知道这对于使用 DirectoryServices 命名空间的 Active Directory 来说相当容易,但我找不到旧 NT4 域的任何内容。 如果可能的话,我宁愿不使用 API 调用(但这可能要求有点高)。
另外,为了奖励积分(!),我们最终将在今年秋天晚些时候切换到 Active Directory,那么当我们迁移时,我将如何构建一种将我的域列表自动从 NT4 切换到 AD 的方法(所以我不需要重新编译并重新发布)
Does anyone know (in c#) a way of getting the available NT4 domains (a bit like the WinXP login box dropdown)?
I know that this is fairly easy for Active Directory using the DirectoryServices namespace, but I can't find anything for the old NT4 domains. I'd rather not use API calls if at all possible (that might be asking a bit much however).
Also, for bonus points (!), we are finally switching to Active Directory later on this autumn, so how would I construct a way of my domain list automatically switching over from NT4 to AD, when we migrate (so I don't need to recompile and re-release)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,我认为您唯一的选择是使用 ADSI API。 您可以通过更改代码中的提供程序在 NT4 和 Active Directory 之间切换。 NT4 使用 WinNT 提供程序,Active Directory 使用 LDAP 提供程序。
如果您查询您正在使用的任何提供程序的 RootDSE 节点,它应该返回您可以绑定的命名上下文,包括域。 RootDSE 是 LDAP 模式特定的标识符。 对于 WinNT,您可以将根对象查询为“WinNT:”以获取可用域。
顺便说一句,ADSI 可通过 VB 脚本获得。
Unfortunately I think your only option is to use the ADSI API. You can switch between NT4 and Active Directory by changing providers in your code. NT4 uses the WinNT provider and Active Directory uses the LDAP provider.
If you query the RootDSE node of whichever provider you are using, that should return naming contexts to which you can bind, including domains. RootDSE is an LDAP schema specific identifier. For WinNT you can query the root object as "WinNT:" to get available domains.
ADSI is available through VB script BTW.