I need to query for incremental changes from an Active Directory forest using LDAP.
The easy part is to query for incremental updates of objects, and for creation of new objects. For this you can use the whenChanged
property
Example:
(&(objectClass=user)(whenChanged>=20180501000000.0Z))
So far, so good.
But what about querying for deleted records. Is there some way to query LDAP for all items deleted since a given time?
I do know about the fact that Active Directory marks objects for deletion (doesn't actually delete stuff). And I know there is some way to get deleted objects: (See this msdn post)
But I haven't had much luck creating an LDAP query that, against a very vanilla active directory server, can get a list of deleted accounts.
Related: LDAP query for deleted users
I tried that suggestion too:
(&(isDeleted=TRUE)(userAccountControl:1.2.840.113556.1.4.803:=512))
Still Nothing.
How can I make this work?