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.
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.

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.


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:


Which tells everyone the account was disabled with a script.  That's a best practice right there in our organization.
BrianRBAuthor Commented:
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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. :(
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
hi, any help plz?
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

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

From novice to tech pro — start learning today.