1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| Imports System.DirectoryServices
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Ldap As DirectoryEntry = New DirectoryEntry("LDAP://192.168.1.1", "oussama", "toto")
Dim searcher As New DirectorySearcher(Ldap)
searcher.Filter = "(SAMAccountName=group1)"
Dim DirEntry As DirectoryEntry
For Each result As SearchResult In searcher.FindAll()
DirEntry = result.GetDirectoryEntry
ListBox1.Items.Add(DirEntry.Properties("member").Value)
Next
End Sub
End Class |
Partager