Reputation: 7605
"<LDAP://DC=top,DC=example,DC=com>;(&(objectCategory=person)(objectClass=user)(sn=%lastname%));sAMAccountName,sn,givenName,distinguishedname,userAccountControl,cn"
Above is a snippet of my query that I will send to AD. When I type an EXACT last name, it works without issues. However when I enter a partial last name, I get no results.
Can anyone please tell me how to perform a search on a partial name?
Upvotes: 0
Views: 1005
Reputation: 200233
%
is not a valid wildcard in LDAP filters, and you also can't use environment variables (%variable%
) in VBScript LDAP queries. A filter with a partial value can be defined like this:
(&(objectCategory=person)(objectClass=user)(sn=*something*))
If you want to use a variable in a filter you have to use string concatenation:
"(&(objectCategory=person)(objectClass=user)(sn=" & variable & "))"
Upvotes: 1