Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Search For a user in all domains?

Posted on 2009-04-27
Medium Priority
Last Modified: 2012-05-06
Hello all,
i need to search for a specified user in all trusted domains the tree that we have in our LAN is like this RootDomain.com and we have others domains under this root domain which for example Domain1.RootDomain.com,Domain2.RootDomain.com, and so on. ii want to search for a user by using LDAP path, the error that i face i cannot search for a user in root, so is there a way to search like this or only thru the sub domain that the user belong to.

Question by:baghlaf
1 Comment
LVL 71

Accepted Solution

Chris Dent earned 2000 total points
ID: 24240086

If they're part of the same forest you can search the global catalog and the domain root as the search base. Example below.

Dim ldapFilter As String = "(sAMAccountName=TheUserName)"
Dim adForestRoot As DirectoryEntry("GC://DC=RootDomain,DC=com")
Dim adSearcher As DirectorySearcher(adForestRoot, ldapFilter)
Dim adSearchResult As SearchResult = adSearcher.FindOne()

Open in new window


Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here's a look at newsworthy articles and community happenings during the last month.
Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question