Powershell - Find Disabled Users Based on Date.

I need a script based on the following:

1.  Find disabled users
2.  However, I don't want a list of users that have been disabled within the last 20 days.  I need a list based on the date of 20 days ago.

For example, I've disabled x number of users between 12/10/2011 and today.  I don't want these users to show up in my report.  I want the list to contain users disabled prior to the 10th.
LVL 2
BrianRBAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KenMcFCommented:
When you disable a user there is nothing that is updated to say when it was disabled. You could look at the last modified date but that is not a guarantee. Another way you could do this is update a attribute when you disable the user account. Here is an example from a blog post I did on the scripting guys blog using the MS AD cmdlets.

http://blogs.technet.com/b/heyscriptingguy/archive/2011/11/30/use-powershell-to-find-and-remove-inactive-active-directory-users.aspx 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale HarrisProfessional Services EngineerCommented:
We would put it in the description of the AD account at the time of disabling, example:

DISABLED DUE TO INACTIVE ACCOUNT 12/30/2011

Which tells everyone the account was disabled with a script.  That's a best practice right there in our organization.
0
BrianRBAuthor Commented:
0
What were the top attacks of Q1 2018?

The Threat Lab team analyzes data from WatchGuard’s Firebox Feed, internal and partner threat intelligence, and a research honeynet, to provide insightful analysis about the top threats on the Internet. Check out our Q1 2018 report for smart, practical security advice today!

BrianRBAuthor Commented:
I actually read that exact article earlier this morning.  But I've only been using PS for about 3 days now so it was hard to follow for an idiot such as I. :(
0
cawasakiCommented:
HI and thanks Brian,

Yes  i now, no attribute for date of disabled account.

th script must use whenchanged attribute, i now this is not a guarantee, but in my AD, i have only 1 administrator.

the script must get the date and export in a csv file a list of user.

thanks for help
0
cawasakiCommented:
hi, any help plz?
0
Dale HarrisProfessional Services EngineerCommented:
Cawakasi, This question has been closed and points have been assigned.  If you would like, you can ask a related question here: http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/newQuestionWizardRelated.jsp?qid=27514580

DH
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.