Solved

Active Directory - Search filter optimization

Posted on 2010-08-17
4
835 Views
Last Modified: 2012-08-14
Hello Experts,

I'm building an ASP.NET webpage that pulls the users info via Active Directory.  Right now it's working, but slower than I'd like.  So I'm trying to optimize my search filter in hopes of speeding up the search.  Right now my search filters is setup like so:

Mysearcher.Filter = "(&(objectCategory=person)(objectClass=user)(samAccountName=" & strNetworkID & "))"

Can anyone help me to tweak this for faster performance?

Thanks,
Moe
0
Comment
Question by:mauricerichard
  • 2
  • 2
4 Comments
 
LVL 2

Expert Comment

by:mrfixit584
ID: 33454818
The filter is pretty much as lean as it can be. The question is, how much of the tree are you searching, and do you need to search the entire tree? If all of your users are in a sub-OU, you could restrict your search to that OU instead of searching the entire structure.
0
 
LVL 1

Author Comment

by:mauricerichard
ID: 33464251
Hi Mrfixit584,

I'm struggling with Active Directory, so pardon any silly questions.  
Where would I indicate this, in the search filter or DirectoryEntry?

See code sample for examples

Thanks,
Moe
Mysearcher.Filter = "(&(objectCategory=person)(objectClass=user)(samAccountName=" & strNetworkID & "))"



'OR



Dim rootEntry As New DirectoryEntry("LDAP://domain/DC=domainDN,DC=com", "username", "password")

Open in new window

0
 
LVL 2

Accepted Solution

by:
mrfixit584 earned 500 total points
ID: 33562073
It would be part of the LDAP call. instead of LDAP://dc=domain,dc=com, make it more specific. LDAP://ou=myOU,dc=domain,dc=com. For some of my searches, this isn't possible, but if the objects you are searching are in a certain location, you can specify the location so the search doesn't include the entire domain.
0
 
LVL 1

Author Comment

by:mauricerichard
ID: 33599040
Sorry been away from the office.  Great info, thanks very much!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction You may have a need to setup a group of users to allow local administrative access on workstations.  In a domain environment this can easily be achieved with Restricted Groups and Group Policies. This article will demonstrate how to…
In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
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 to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now