troubleshooting Question

Query Active Directory for Inactive User Accounts

Avatar of fireguy1125
fireguy1125 asked on
Active DirectoryWindows Server 2008
3 Comments1 Solution827 ViewsLast Modified:
I need to modify an existing dsquery command that I am running in order to generate AD accounts that have a Days since last logon of 180 or 6 months.  I asked a similar question to where I got to this point and can be referenced here.  I believe it is only an additional parameter to be added, but not quite sure where. I was looking at including the -inactive 24 command, but it is giving me an error:

This is the current query I'm running:

dsquery * "dc=company,dc=com" -Filter "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))" -limit 0 | dsget user -samid -upn -empid > C:\ADExport.txt

This is my previous question:
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros