0

What would be the syntax for LDAP for the below scenario:

Where sAMAccountName = GRA-* without $. I want the records which are highlighted in green.

This is my current LADP Filter for your reference:

(&(objectClass=user)sAMAccountName=GRA-*))

Anyone, Please help with the correct syntax.

1 Answer 1

2

Your filter can work, but you're missing a ( in front of sAMAccountName:

(&(objectClass=user)(sAMAccountName=GRA-*))

But you may be able to do better. If those ones that end in $ are computer objects (which always have sAMAccountNames that end in $, but also have an objectClass of user), then you can make sure you only get user objects by including (objectCategory=person):

(&(objectClass=user)(objectCategory=person)(sAMAccountName=GRA-*))

If, for whatever reason, those $ objects are actually user accounts, then you can exclude them with (!sAMAccountName=*$):

(&(objectClass=user)(objectCategory=person)(sAMAccountName=GRA-*)(!sAMAccountName=*$))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.