hamda000
asked on
displaying computer name in listbox without "CN".
I found this code and it is working for me.
I'm trying to display a list of computer from a specific OU but in the listbox, I got the real name with the Common Name prior to the real name.
EXemple:
CN=COMPUTER NAME
Here is my code
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------
Imports System
Imports System.Net
Imports System.DirectoryServices
Imports System.DirectoryServices.A ctiveDirec tory
Public Class frmMediaProjectorTest
Private Sub frmMediaProjectorTest_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
'Affiche la liste des ordinateurs du OU Médiatisation
Dim domain As DirectoryEntry = New DirectoryEntry("LDAP://OU= ORDI-MEDIA TISATION,o u=ORDINATE URS,OU=AD2 008,DC=ceg ep-st-laur ent,DC=qc, DC=ca")
For Each child As DirectoryEntry In domain.Children
'remplir la liste avec les nom des postes Médiatisation
lstProjectors.Items.Add(ch ild.Name). ToString()
Next
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
'Quitter le programme
Me.Close()
End Sub
End Class
I'm trying to display a list of computer from a specific OU but in the listbox, I got the real name with the Common Name prior to the real name.
EXemple:
CN=COMPUTER NAME
Here is my code
--------------------------
Imports System
Imports System.Net
Imports System.DirectoryServices
Imports System.DirectoryServices.A
Public Class frmMediaProjectorTest
Private Sub frmMediaProjectorTest_Load
End Sub
Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
'Affiche la liste des ordinateurs du OU Médiatisation
Dim domain As DirectoryEntry = New DirectoryEntry("LDAP://OU=
For Each child As DirectoryEntry In domain.Children
'remplir la liste avec les nom des postes Médiatisation
lstProjectors.Items.Add(ch
Next
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
'Quitter le programme
Me.Close()
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER