Link to home
Start Free TrialLog in
Avatar of fireguy1125
fireguy1125

asked on

Query Active Directory for Inactive User Accounts

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:

https://www.experts-exchange.com/questions/28232804/Query-Active-Directory-for-Active-User-Accounts.html
ASKER CERTIFIED SOLUTION
Avatar of Mike Kline
Mike Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fireguy1125
fireguy1125

ASKER

Thanks again
No problem glad you were able to get your reports.

Thanks

Mike