|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DirectorySearcher.Filter doesnt seem to workcertain user by username. In doing some testing I noticed that its not filtering everything out exept for user ObjectClass. It seems to be pulling computers as well. Not sure why this is happening but need to limit it to just user objects. Here is the code I have. Imports System Imports System.DirectoryServices Namespace ActiveDirectorySearch Public Class ADSearch Shared Sub main(ByVal strUserName As String) Dim DSESearcher As New DirectorySearcher() DSESearcher.SearchScope = SearchScope.Subtree DSESearcher.Filter = "(objectClass=user)" Dim objResults As SearchResult For Each objResults In DSESearcher.FindAll() Console.WriteLine(objResults.GetDirectoryEntry.Properties("samaccountname").Value & "...." & objResults.GetDirectoryEntry.Path) Next End Sub End Class End Namespace |
|||||||||||||||||||||||