使用VB.net列出OU计算机 [英] List OU computers using VB.net

查看:78
本文介绍了使用VB.net列出OU计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在此网站上找到了此代码.


Hi everyone,

I found this code here in this website.


Public Function GetComputers() As String
Dim result As String = ""

' Get the domin name
Dim ipproperties As NetworkInformation.IPGlobalProperties = NetworkInformation.IPGlobalProperties.GetIPGlobalProperties()
Dim domain As String = ipproperties.DomainName

Dim domainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" + domain)
domainEntry.Children.SchemaFilter.Add("computer")

For Each computer As DirectoryEntry In domainEntry.Children
    result = result & computer.Name & Environment.NewLine
Next

Return result

End Function



此代码可以很好地列出域中的计算机.我想看到的是特定OU中的计算机列表.这是我的架构的样子:

域\ OU \ OU \ OU \ OU

我想在第四和最后一个OU中列出计算机.
有帮助吗?
谢谢大家.



This code works fine to list computer in a domain. What I would like to see is a list of computers in a specific OU. Here is how my architecture looks like:

Domain\OU\OU\OU\OU

I would like to list the computers in the forth and last OU.
Any help?
thanks everyone.

推荐答案

尝试输入目录的路径LDAP.
http://msdn.microsoft.com/en-us/library/87tye19w.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/system. directoryservices.directoryentry.path.aspx [ ^ ]
Try LDAP path for directory entry.
http://msdn.microsoft.com/en-us/library/87tye19w.aspx[^]
http://msdn.microsoft.com/en-us/library/system.directoryservices.directoryentry.path.aspx[^]


非常感谢.我尝试了建议(在第二个链接中),但是没有运气.仍然无法使用.

你能帮忙吗?
谢谢.
thanks a lot. I tried the suggestions (in the second link) but no luck. Still not working.

Can you help please?
thanks.


这篇关于使用VB.net列出OU计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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