views:

43

answers:

2

I have this app that loops thru my AD and I would like it to notify me on changes. IE if someone changed their email, a user was added and so on. I was thinking of checksum DirectoryEntry object that gets the root AD object with all its children but i cant wrap my head around it.

DirectoryEntry entry = 
    new DirectoryEntry("LDAP://" + domain, username, password);

the app im making is a windows service that will check AD every hour for changes, sizeof is a nogo as microsoft dont want me to know the size of this managed object. any suggestions?

+1  A: 

HashCode? override the Object.GetHashCode property?

Bryce Fischer
While this won't guarantee to capture ALL modifications, when the hash is different, you can guarantee that the AD record has changed.
Keith
True, depends on how the hashcode is generated in that class...
Bryce Fischer
+1  A: 

You may want to look into the DirectorySynchronization class. When searching the AD using DirectorySearcher with the DirectorySearcher.DirectorySynchronization property set, a cookie is generated that you can save to a file or database. Using this cookie in following similar searches will ensure that only objects that have changed between two searches are returned by DirectorySearcher. IIRC it will even tell you which properties have changed.

Jakob Christensen