I am able to successfully query LDAP user objects from an Active Directory Server. I can also return computer objects, but I get an error response if I try to apply a filter to filter out disabled accounts:
Failed to invoke procedure apoc.load.ldap
: Caused by: java.lang.RuntimeException: Error getting next ldap entry null
Here's the example code. The USERS query works fine, but the COMPUTERS query fails unless you remove the account control filter: !(userAccountControl:1.2.840.113556.1.4.803:=2)
// ONLY ENABLED Computers:
call apoc.load.ldap({ldapHost:'dc1.mydomain.com',loginDN:'cn=queryservice,cn=Managed Service Accounts,DC=mydomain,DC=com',loginPW:'supersecretpassword'},
{searchBase:'dc=mydomain,dc=com',searchScope:'SCOPE_SUB',attributes:['cn'],searchFilter:'(&(objectClass=computer))!(userAccountControl:1.2.840.113556.1.4.803:=2)'})
yield entry
// ONLY ENABLED USERS:
call apoc.load.ldap({ldapHost:'dc1.mydomain.com',loginDN:'cn=queryservice,cn=Managed Service Accounts,DC=mydomain,DC=com',loginPW:'supersecretpassword'},
{searchBase:'dc=mydomain,dc=com',searchScope:'SCOPE_SUB',attributes:['displayname','company','cn','mail','sAMAccountName','userPrincipalName','dn'],searchFilter:'(&(objectClass=user))!(userAccountControl:1.2.840.113556.1.4.803:=2)'})
yield entry