Attempting to perform a nested apoc.load.ldap
1st query (return all domain controllers and their DNS name) (this works fine!)
2nd query take each domain controller, connect to it, and query the lastlogon property for users on that domain controller. (then use this to create [:LOGGED_ON] relationships between LDAP users and domain controllers). I don't think I'm properly parameterizing the resulting values for use in the 2nd apoc.local.ldap call. Here's my code:
call apoc.load.ldap({ldapHost:'edc-dc3.mydomain.com',loginDN:'cn=_queryuser,cn=Managed Service Accounts,DC=mydomain,DC=com',loginPW:'MyPassw0rd'},
{searchBase:'ou=Domain Controllers,dc=mydomain,dc=com',searchScope:'SCOPE_SUB',
attributes:['dn','dNSHostName'],
searchFilter:'(&(objectCategory=computer)(objectClass=computer)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))'})
yield entry as dc
with dc
:params {ldapprops: [{ldapHost: dc.dNSHostName, loginDN: "n=_queryuser,cn=Managed Service Accounts,DC=mydomain,DC=com", loginPW: "MyPassw0rd"}]}
call apoc.load.ldap(ldapprops,{searchBase:'ou=Hosted,dc=mydomain,dc=com',searchScope:'SCOPE_SUB',attributes:['userPrincipalName','LastLogon','userAccountControl'],
searchFilter:'(&(samAccountType=805306368))'})
yield entry as user
return user
The error I'm getting is:
Neo.ClientError.Statement.SyntaxError: Invalid input 'c': expected whitespace, comment or a relationship pattern (line 8, column 1 (offset: 580))
"call apoc.load.ldap(ldapprops,{searchBase:'ou=Hosted,dc=mydomain,dc=com',searchScope:'SCOPE_SUB',attributes:['userPrincipalName','LastLogon','userAccountControl'],"
^