Using SCCM discovery to filter collections by AD Activity
Those of you that are using the Enhanced System Discovery Tool are already familiar with this procedure. But what if you don't have ESD but do indeed have SCCM deployed? You can still pull this attribute into ConfigMgr and then use it throughout your queries and collections.
The first thing you will need to do is modify your AD System Discovery properties to include the whenChanged attribute. This can be found under the Active Directory attribute.
Once you have added this attribute you will want to select the Polling Schedule tab and checkbox the Run discovery as soon as possible if you want the new data for the whenChanged attribute to start showing up right away. Keep in mind this will increase system activity during this activity.

And to verify that it is indeed collecting it you can click on properties on a resource in the All Systems collection and browse through the data discovery data to see the new whenChanged property as well as its value as shown to the right. The values may take awhile as your System Discovery runs and you may also discovery many Null values as well.

Now that you have your new whenChanged property being populated into ConfigMgr you will simply need to create a query to utilize this data for your own benefit. Here is an example of a query that displays all machines that have an AD Activity Greater than 28 Days (Using whenChanged property):
select SMS_R_SYSTEM.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System where (DateDiff(day, whenChanged, GetDate()) > 28)
Now simply add that query into one of your collections and you can use the collection as a targeting or clean collection or how ever you prefer to use it.
P.S. Once you paste this query statement into the query language window you will not be able to go back to the Show Query Design window as the DateDiff function is not supported in that view. It has no effect on the query or results though.