获取网络域上的用户列表
我想返回使用 VB.Net 获取网络域上的用户列表。
我将拥有可供我使用的域名。
提前致谢。
I want to get back to get a list of users on a network domain using VB.Net.
I will have the domain name available to me for use.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
它可能会在选择查询中引发错误。
请检查:
您是否向项目中添加了对 System.Management 程序集的引用?如果还没有,请执行以下操作:
在 VS 中,单击“项目”菜单 >“项目”>“项目”。添加参考。
在 .Net 选项卡上,向下滚动直至看到 System.Management。单击它进行选择,然后单击“确定”。
现在回到您的代码,在类的最顶部,输入“Imports System.Management”,您应该已准备就绪。
来源:
http://www.vbforums.com/showthread.php?t=560422
它对我来说没有任何问题。我能够获取该域的所有用户名。
It might throw an error in the select query.
Please check this:
Did you add a reference to the System.Management assembly to your project? If you haven't, do this:
In VS, click on Project menu > add reference.
On the .Net tab, scroll down until you see System.Management. Click on it to select, then click OK.
Now back in your code, at the very top of your class, put in "Imports System.Management", and you should be all set.
Source:
http://www.vbforums.com/showthread.php?t=560422
It worked for me without any issues. I am able to get all user names for the domain.
可能会为您指明正确的方向
使用 System.DirectoryServices 和 System.DirectoryServices.ActiveDirectory: End Function
Something like this might point you in the right direction, using System.DirectoryServices and System.DirectoryServices.ActiveDirectory:
End Function
这可行,但我如何按特定组进行过滤。我收到了数千个结果
This works but how do i filter by a certain group. Im getting THOUSANDS of resutls
另一种选择是探索 System.Management 和 System.Management.Instrumentation。以下是一个简短的代码片段您可以使用这些命名空间拉取特定域的用户。
Another option would be exploring System.Management and System.Management.Instrumentation.Here is a short snippet of how you pull the users of a particular domain using these namespaces.