user443180
user443180

Reputation: 231

How to know if Users of an AD group in Active Directory has been updated since a given timestamp

In our project we have a concept of trusted users for which we specify Active Directory Group as trusted group. We fetch all users of a given trusted group and use them as trusted users.

We need to sync users of the AD group periodically. When an AD group contains large number of users, it is a network/memory intensive task, so before syncing users of a group we want to know if AD group has changed.

So want to know is there any attribute in AD group that can be used to know if the AD group has changed since last time it has been synced.

Upvotes: 1

Views: 999

Answers (1)

Daro
Daro

Reputation: 2020

whenChanged

Shows you the last modification date.

Find it like this:

DirectoryEntry de = new DirectoryEntry("LDAP://CN=Group,OU=Groups,DC=domain,DC=com");
DateTime changed = (DateTime)de.Properties["WhenChanged"][0];

Compare with DateTime or TimeSpan functions.

Upvotes: 1

Related Questions