I have a problem with reading OU=Users
from my test server 2008, but OU=People
(I have created) works. Error, it shows me is:
This object not exist on server
Imports System.DirectoryServices
Imports System.DirectoryServices.ActiveDirectory
Imports System.Text
Imports System
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ADVstup As New DirectoryEntry("LDAP://192.168.1.1/OU=People,DC=pokus,DC=local", "Administrator", "Administrator")
Dim ADVyhledani As New DirectorySearcher(ADVstup)
Dim vysledky As SearchResultCollection
Dim vysledek As SearchResult
vysledky = ADVyhledani.FindAll
For Each vysledek In vysledky
MessageBox.Show(vysledek.GetDirectoryEntry.Properties("sAMAccountName").Value)
Next
End Sub
End Class
Any idea about the cause of the error?