This is why I tried again a year and a half ago.
Development Environment: Window XP
Development Tool: Visual stutio 2003 (later use visual stutio 2005 to re-upload the code)
Opening statement: VB. NET
Development Time: January
Starting from the source region
Rows
Program description
Private sub button#click () sub button#click (byval sender as system. Object, byval e as system. eventargs) handles button1.click
Dim domain as string = me. textbox1.text
Dim username as string = me. textbox2.text
Dim password as string = me. textbox3.text
Try
Dim ad as new system. directoryservices. directoryentry ("LDAP: //" & domain, username, password)
St + = AD. Name & vbcrlf
Showad (AD, 0)
Catch ex as exception
MessageBox. Show ("loading into zookeeper or cannot fetch ad ")
Exit sub
End try
MessageBox. Show ("zookeeper normal" + vbcrlf + st)
Application. Exit ()
End sub
Sub showad () sub showad (byval ad as system. directoryservices. directoryentry, byval level as integer)
For each adchildren as system. directoryservices. directoryentry in AD. Children
If me. combobox1.selectedindex =-1 then
St & = Microsoft. VisualBasic. Strings. strdup (level, "-") & adchildren. Name & ";" & adchildren. schemaclassname & vbcrlf
If me. checkbox1.checked = true then
For each itemname as string in adchildren. properties. propertynames
For each items as object in adchildren. properties (itemname)
St & = Microsoft. VisualBasic. Strings. strdup (LEVEL + 1, "-") & itemname &":"
Try
St & = items & vbcrlf
Catch ex as exception
St & = "unable to connect" & vbcrlf
End try
Next
Next
End if
Elseif adchildren. schemaclassname = me. combobox1.selecteditem then
St & = Microsoft. VisualBasic. Strings. strdup (level, "-") & adchildren. Name & ";" & adchildren. schemaclassname & vbcrlf
If me. checkbox1.checked = true then
For each itemname as string in adchildren. properties. propertynames
For each items as object in adchildren. properties (itemname)
St & = Microsoft. VisualBasic. Strings. strdup (LEVEL + 1, "-") & itemname &":"
Try
St & = items & vbcrlf
Catch ex as exception
St & = "unable to connect" & vbcrlf
End try
Next
Next
End if
End if
Showad (adchildren, level + 1)
Next
End sub
. NET and LDAP (Protocol 1) Use System. directoryservices. directoryentry
The format of the constructor is as follows:
Dim ad as new system. directoryservices. directoryentry ("LDAP: //" & domain, username, password)
Call showad to retrieve the sub-vertex information after the connection is normal.
Brief one LDAP (Lightweight Directory Access Protocol) Protocol