Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
Imports System.DirectoryServices Public Class Form1 Public Shared Function GetDirectoryEntry() As DirectoryEntry Dim dirEntry As New DirectoryEntry("LDAP://domain") dirEntry.Username = Nothing dirEntry.Password = Nothing dirEntry.AuthenticationType = AuthenticationTypes.Secure Return dirEntry End Function Public Shared Function GetDirectorySearch() As DirectorySearcher Dim dirEntry As DirectoryEntry = GetDirectoryEntry() Dim dirSearcher As DirectorySearcher = New DirectorySearcher(dirEntry) Return dirSearcher End Function Private Sub exportfromad_Click(sender As System.Object, e As System.EventArgs) Handles exportfromad.Click Dim de As DirectoryEntry = GetDirectoryEntry() Dim deSearch As DirectorySearcher = New DirectorySearcher() deSearch.SearchRoot = de Dim test As String Dim count As Integer deSearch.Filter = "(&(objectClass=group) (samAccountName=" & "*" & "))" Dim results As SearchResultCollection = deSearch.FindAll() For Each r As SearchResult In results Try If r.GetDirectoryEntry.Name.Contains("product") Then count += 1 test += r.GetDirectoryEntry.Name & vbCrLf End If Catch End Try Next MsgBox(test) MsgBox(count) End Sub End Class
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.