• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 65
  • Last Modified:

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.
1
CiscoAzn
Asked:
CiscoAzn
2 Solutions
 
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/DeveloperCommented:
1
 
CiscoAznAuthor Commented:
Thanks! This is really helpful.
0
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.

Join & Write a Comment

Featured Post

Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now