Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Feb 16, 2012 07:23 PM|LINK
I have the following simple code that works perfectly from an AD-joined computer:
Dim sName As String = sUserID
Dim oRoot As DirectoryEntry = New DirectoryEntry
Dim oSearcher As DirectorySearcher = New DirectorySearcher
Dim oResults As SearchResultCollection
oRoot.Path = "LDAP://OU=Users,OU=Hgies,DC=rci,DC=youit,DC=ca"
oSearcher.SearchRoot = oRoot
oSearcher.Filter = "(&(objectclass=User)(objectCategory=person)(sAMAccountName=" & sName & "))"
oResults = oSearcher.FindAll() ----------- error here if ran from a non-AD joined computer
However, when I run it from a non-AD computer I experience the following error on the last line (in bold):
The specified domain either does not exist or could not be contacted.
I tried to include credentials, something like:
oRoot.Username = "domain\username"
oRoot.Password = "******"
but it does not make any difference…