Today I had the need to find a list of users with an expiration date in my A.D. environment.
An additional information I was interested in was not only to know if the user had an expiration but also the date in which the user actually expires.
I know there are a lot of ways to have the information above but the GenericADO script of Richard Mueller really made my day.
The original code and explanation is here Generic ADO Searches
The script is really powerfull, but in my situation it was enough to follow what Richard says here LDAP Account Expiration Query
If you want to do a search on the entire directory, you need only to insert the LDAP filter syntax
(&(objectCategory=person)(objectClass=user))
and a list of the attributes to export sAMAccountName,accountExpires If you want to put all in a csv file, the command line would be something like
cscript GenericADO.vbs /csv > c:\export.csv
That’s all, and thank you again to Richard :-)
This article is available in other languages, including Italian.