Powershell script to disable inactivity after 15 days

Need to have a script to disable user accounts after 15 days of inactivity from a certain OU.
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.

Sekar ChinnakannuSr Infra Security AdministratorCommented:
Hope this one you looking, Makw sure you customize based on your requirement like 15 days http://ad.kazakinfo.com/2013/10/powershell-auto-disabling-inactive-users/
E ATech LeadCommented:
Something like:

dsquery user "OU=Users,DC=Domain,DC=com" -inactive 4 | dsmod user -disabled yes

Open in new window

You can use MVP Joe Richards free solution oldcmp.exe & it works best.

OldCmp.exe -users -report -age 15
OldCmp.exe -users -age 15 -disable -format csv

Else, try this solution to identify and clean up inactive Active Directory user accounts:

Hope this helps!
Sam BloomCommented:
Here's a complete PowerShell solution that does AD cleanup for all sorts of inactive objects that should help: http://www.adaxes.com/blog/cleanup-active-directory-with-powershell.html
Shaun VermaakTechnical SpecialistCommented:

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
CiscoAznAuthor Commented:
Thanks! This is really helpful.
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.