How to DSQuery enabled user who have been inactive for 90 days

Can some familiarwith DSQuery show how to run a query for
1. enabled users only
2. users who have been inactive for 90 or more days
JoeyBugeyesAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Matthew MillersConnect With a Mentor Commented:
You may be able to pipe the results out to dquery again:

dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User)(!
serAccountControl:1.2.840.113556.1.4.803:=2))" -limit 0 | dsquery user -inactive
 4

You may want to pay attention to what Jay Jay has indicated, although this is for old computer accounts (the joeware util).
0
 
Matthew MillersCommented:
dsquery user -inactive <weeks>

I am not sure about showing if someone is enabled, you can show who is disabled by using -disabled
You may be able to do something with adfind
0
 
Jay_Jay70Commented:
the inactive switch has always been hit and miss, you would be better off playing with oldcmp from joe
http://www.joeware.net/freetools/
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
JoeyBugeyesAuthor Commented:
Mattee76,
You're on the right track as far as what i'm looking for.  Now if only we can combine what you provided with the following to give me a list of enabled but inactive accounts.  

List all enabled user accounts: dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User)(!userAccountControl:1.2.840.113556.1.4.803:=2))" -limit 0

Thanks for your responses so far folks.
0
 
Jay_Jay70Commented:
ahhh with the correct switches it will also work for user accounts :)
0
 
JoeyBugeyesAuthor Commented:
Nice.  I knew you could port DSQuery to a DSGet, but I didn't know you could port it to another dsquery.  Very nice!  Thanks everyone for contributing.
0
 
ESParteeCommented:
Were you able to make this work?  I am unable to pipe the dsquery results (Enabled Accounts) into the 2nd dsquery (Inactive Accounts).  Isn't there an easy way to query for Enabled AND Inactive Accounts?
0
 
JD_PowersCommented:
rank master my ass he didn't take 5 seconds to test his solution
0
 
elchermansCommented:
This is true, the above mentioned "Accepted Solution" Does NOT work!

Still looking for a working solution
0
All Courses

From novice to tech pro — start learning today.