<

Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x

Active Directory Cleanup Tool (ADCleanup)

Published on
8,736 Points
536 Views
2 Endorsements
Last Modified:
Shaun Vermaak
My name is Shaun Vermaak and I have always been fascinated with technology and how we use it to enhance our lives and business.
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..

Introduction


ADCleanup is my implementation of a set-and-forget Active Directory cleanup tool. Once this tool is implemented correctly, you never need to worry about dormant accounts ever again.


Implementation


1) Download and extract ADCleanup.zip (here is VirusTotal scan) to a folder of your choice, saved on the computer on which it will be scheduled to run.

2) Create a location in Active Directory to store inactive user accounts and record the distinguished name (DN).




3) Create a location in Active Directory to store inactive computer accounts and record the distinguished name (DN).



4) Run Configurator.exe (Configurator Editor).


a) On the Encrypt tab, enter the password for the account that will be performing the cleanup task. Encrypt it with key 9hOK7AtlGOCRyBtBdhF9pnTQuk8ES176 and record encrypted password



b) On the Settings tab, enter the fully qualified domain name, cleanup account user name and the encrypted password recorded in step 4a

c) Set userCleanup to true to enable the process to clean up user accounts. Set user cleanup parameters

d) Set userDisabledOUto value recorded in step 2

e) Set computerCleanup to true to enable the process to clean up user accounts. Set computer cleanup parameters

f) Set computerDisabledOU to value recorded in step3



g) On the userExcludedDNs tab, specify any distinguished name of an organizational unit that should be excluded from the cleanup process



g) On thecomputerExcludedDNstab, specify any distinguished name of an organizational unit that should be excluded from the cleanup process



h) Schedule ADCleanup.exe to execute via a scheduled task. Upon every execution, the tool will clean up user and computer objects as per your configuration


Conclusion


Using this process, (or one similar) will keep Active Directory clean from the unused computer and user objects, and increases server security in the process.


Please do not forget to press the "Thumb's Up" button if this article was helpful and valuable for EE members.


It also provides me with positive feedback. Thank you!

2
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 1

Expert Comment

by:Sam Bloom
You can also look for unused OUs and empty groups in AD. Here's a PowerShell script that can help with that: http://www.adaxes.com/blog/cleanup-active-directory-with-powershell.html
1
 
LVL 8

Expert Comment

by:Senior IT System Engineer
Rather than deleting the unused AD account and Computer object, is it possible to just move it into certain OU ?
0
 
LVL 36

Author Comment

by:Shaun Vermaak
Hi Senior IT System Engineer. I will update article because this might be a little unclear, you can achieve that desired effect by setting the DeleteLimits to 0
1
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:Alan
Hi Shaun,

Would it be possible to just get a report of exceptions, rather than deleting or moving anything?

Thanks,

Alan.
1
 
LVL 36

Author Comment

by:Shaun Vermaak
Hi Alan,

Yes, you can. Set the delete and disable values to 0 and enable verbose

Regards
Shaun
0
 
LVL 17

Expert Comment

by:Alan
Hi Shaun,

From:  Shaun Vermaak


Hi Alan,

Yes, you can. Set the delete and disable values to 0 and enable verbose

Regards
Shaun

Brilliant - great tool :-)

Thanks,

Alan
1
 

Expert Comment

by:geekgirl472
Is there a way to delete the inactive users' home folders as well?

I'd like to get a report based on your instructions above and then go back and delete inactive user accounts along with their home folders as well.

Thank you very much!
0
 
LVL 36

Author Comment

by:Shaun Vermaak
I have a tool UserResourceCleanup that can do this. If you want I can post as an article?
1
 

Expert Comment

by:geekgirl472
Yes, please. I would be very grateful. Thank you!
0
 
LVL 36

Author Comment

by:Shaun Vermaak
Here is link to user data cleanup tool (UserResourceCleanup) https://www.experts-exchange.com/articles/31021/UserResourceCleanup.html
1

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Join & Write a Comment

This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month