runswithsizzors
Well-known member
I was doing some basic Active Directory Programming to try to learn how to program AD, connect to it and pull information from it. I ran the program I created on a 2003 box and I recieved a security warning that the program wasn't allowed to do this. What do I have to do so I can pull information from active directory?
Here is the Code that I have:
Imports System
Imports System.DirectoryServices
... More Code ...
Dim enTry As DirectoryEntry = New DirectoryEntry("LDAP://" & DBox.Text)
Dim mySearcher As DirectorySearcher = New DirectorySearcher(enTry)
Dim resEnt As SearchResult
Try
mySearcher.Filter = ("(objectClass=*)")
For Each resEnt In mySearcher.FindAll
IBox.AppendText(resEnt.GetDirectoryEntry().Name.ToString() & vbCrLf)
IBox.AppendText(resEnt.GetDirectoryEntry().Path.ToString() & vbCrLf)IBox.AppendText(resEnt.GetDirectoryEntry().NativeGuid.ToString() & vbCrLf)IBox.AppendText("===========================================" & vbCrLf & vbCrLf)
Next
Catch ex As Exception
MessageBox.Show(ex.Message & ex.Source)
End Try
That is all I was trying to do. Thanks!
Here is the Code that I have:
Imports System
Imports System.DirectoryServices
... More Code ...
Dim enTry As DirectoryEntry = New DirectoryEntry("LDAP://" & DBox.Text)
Dim mySearcher As DirectorySearcher = New DirectorySearcher(enTry)
Dim resEnt As SearchResult
Try
mySearcher.Filter = ("(objectClass=*)")
For Each resEnt In mySearcher.FindAll
IBox.AppendText(resEnt.GetDirectoryEntry().Name.ToString() & vbCrLf)
IBox.AppendText(resEnt.GetDirectoryEntry().Path.ToString() & vbCrLf)IBox.AppendText(resEnt.GetDirectoryEntry().NativeGuid.ToString() & vbCrLf)IBox.AppendText("===========================================" & vbCrLf & vbCrLf)
Next
Catch ex As Exception
MessageBox.Show(ex.Message & ex.Source)
End Try
That is all I was trying to do. Thanks!