VMware Cloud Community
mschubi
Enthusiast
Enthusiast

search for AD user with LDAP search string

Hello,

is there a way to use LDAP search strings with vCO/vRO AD Plugin to find users?

ActiveDirectory.searchRecursively(string,string) doesn't do the job 😞

best regards,

Mike

Reply
0 Kudos
4 Replies
kericmiles
Enthusiast
Enthusiast

Currently there isn't, the search functions only use the name of the object.

Reply
0 Kudos
schepp
Leadership
Leadership

Hi Mike,

how do you want to find your users?

I can locate users in my AD with:

ActiveDirectory.searchRecursively("User",input);

Where input is part of the username.

Tim

Reply
0 Kudos
mschubi
Enthusiast
Enthusiast

Hi Tim,

i would like to searcg with LDAP search filters.

Example:

(&(objectClass=user)(| (cn=mike*)(cn=steve*)(cn=foo*)))  ---> all users where steve, mike or foo in Name

(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=2))  ---> all disabled Users

A test with ActiveDirectory.seach, ActiveDirectory.searchRecursively gets no results. In my opinion allthsi functions

build LDAP strings with the srach string.

I am wondering that an AD Class doesn't support LDAP filter search.....

best regards,

Mike

Reply
0 Kudos
helmi1987
Contributor
Contributor

this entry is a bit older but here's my action with LDAP filter

var adObjectSID = "ObjectSID from ActiveDirectory";

var sIDQuery = "(&(objectSID="+adObjectSID+"))"

var splitedDistinguishedName = ActiveDirectory.getAllDomainControllerComputers()[0].distinguishedName.split(",");

var n = splitedDistinguishedName.length - 1;

var baseDN = splitedDistinguishedName[n-1]+","+splitedDistinguishedName[n];

var adObjectBySID =  ActiveDirectory.searchForEntry(baseDN,LdapSearchScope.SUB,5,sIDQuery,null);

if (adObjectBySID != null){

return adObjectBySID

} else {

throw "SID not Found in ActiveDirectory Plugin"

}

Greetings Helmi