How can I query AD to give me all users that are enabled, but not expired? I use the QuestAD tools with PowerShell but it doesn't have a "-NotExpired" option or equivalent with Get-QADUser.
I would prefer a PowerShell solution if possible to make it easier for me to play with the data.
Never mind - seems the object itself has a boolean "AccountIsExpired" flag I can test for.
Get-QADUser -Enabled -AccountNeverExpires -SizeLimit 0
You should be able to do this with a ADO ADSI query:
will give all the non-disabled accounts that don't expire.
will give you all of the non-disabled user objects that expired before 1/16/2006
Here's an example of how to do an ADO ADSI query:
And according to this post... you'll get the answer much quicker this way then you would with a cmdlet. Also here is a great guide to ADO ADSI, it's references VBscript examples, but you can easily translate the concepts back to Powershell.