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