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.
CiscoAznAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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 ChinnakannuStaff EngineerCommented:
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/
0
Ajit SinghCommented:
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:
https://www.lepide.com/lepideauditor/active-directory-cleanup.html

Hope this helps!
0
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
1
Shaun VermaakTechnical Specialist IVCommented:
1

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