Solved

LDAP Query - User Filter

Posted on 2011-03-09
4
1,109 Views
Last Modified: 2012-05-11
Dear all,

I need help to correct this LDAP query. I would like to import all users in sharepoint with:

 - That starts with:
   a-, d-, e-, b-, t-, s-, r-, p-, g-, f-

 -Do not be disabled users
 - Have the attribute: pmiIMDLAttribute1

My query is:
(&(objectCategory=Person)(objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2)(pmiIMDLAttribute1=*)(!sAMAaccountname=s-*, a-*, d-*, e-*, b-*, t-*, s-*, r-*, p-*, g-*,f-*)))

How can I verify how many users I list with this query?.
0
Comment
Question by:Gonzalo Becerra
  • 2
  • 2
4 Comments
 
LVL 57

Accepted Solution

by:
Mike Kline earned 500 total points
ID: 35085777
You could run that query via ADUC (custom query) or download a tool like adfind to test the output http://www.joeware.net/freetools/tools/adfind/index.htm


adfind -default -f "your LDAP query here"  samaccountname

You say you want users that start with a-*, s-* etc

In your query you used !samaccountname   that will exclude those.  You have to list them out (&(samaccountname=a-*)(samaccountname=d-*)...etc...

Thanks

Mike
0
 
LVL 1

Author Comment

by:Gonzalo Becerra
ID: 35086001
Hi Mike Tahnks :) I re write the query it's ok this query?

- Do not starts with:
   a-, d-, e-, b-, t-, s-, r-, p-, g-, f-

 -Do not be disabled users
 - Have the attribute: pmiIMDLAttribute1


(&(objectCategory=Person)(objectClass=User)(!userAccountControl:1.2.840.113556.1.4.803:=2)(pmiIMDLAttribute1=*)(!sAMAaccountname=s-*)(!sAMAaccountname=a-*)(!sAMAaccountname=d-*)(!sAMAaccountname=e-*)(!sAMAaccountname=b-*)(!sAMAaccountname=t-*)(!sAMAaccountname=r-*)(!sAMAaccountname=p-*)(!sAMAaccountname=g-*)(!sAMAaccountname=f-*))

0
 
LVL 57

Expert Comment

by:Mike Kline
ID: 35086184
Yes that should work, I haven't had time to test but it does look good.

Thanks

Mike
0
 
LVL 1

Author Comment

by:Gonzalo Becerra
ID: 35094178
This is the final query:

(&(objectCategory=Person)(objectClass=User)(!userAccountControl:1.2.840.113556.1.4.803:=2)(pmiIMDLAttribute1=*)(!sAMAccountName=s-*)(!sAMAccountName=a-*)(!sAMAccountName=d-*)(!sAMAccountName=e-*)(!sAMAccountName=b-*)(!sAMAccountName=t-*)(!sAMAccountName=r-*)(!sAMAccountName=p-*)(!sAMAccountName=g-*)(!sAMAccountName=f-*))


Thanks a lot Mike!
0

Join & Write a Comment

Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
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…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

747 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

9 Experts available now in Live!

Get 1:1 Help Now