GPO TO DISABLE INACTIVE ACCOUNTS IN AD 2008

Hunter24
Hunter24 used Ask the Experts™
on
I need to remove users and computers account that has not logged in to the network in the past 30 days (AD Cleanup). I want to create new OUs as "Disabled Users" and "Disabled Computers" and move these accounts to its corresponding container using a GPO. Can anyone please tell me how to accomplish this? Your feedback will be greatly appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Neil RussellTechnical Development Lead
Commented:
In a word, you cant. A GPO wont manage ad in that respect.  Your best bet would be a powershell script run in task manager on a daily/weekly basis.
Your best solution here would be to run a daily script to do this, there are lots of examples and ways to get there:

http://www.experts-exchange.com/Software/Server_Software/Active_Directory/Q_24890316.html
Hunter24Office 365 Support Engineer

Author

Commented:
Thank you for your fast response in this issue. However,  I still need you to clarify my doubts,  does that mean that I can create the OUs and the script will move the objects  to it? Can these OUs be created within the Users and computers Containers or should be created somewhere else? Can this script or any other be modified to automatically delete this objects after a certain amount of time assuming that they are in the Disabled container?
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Technical Development Lead
Commented:
Containers should not be used to hold your USERS and COMPUTER objects!  They can not, for one thing, have group policies applied to them.

We do exactly what you are asking but I am not in the office with access to all of the scripts right now.

We extract users who have not logged in for xx days and disable the accounts, move them to a root/DISABLED/USERS OU.
After a further xxx days, users in that OU are then deleted.

We also remove users from ALL groups as they are disabled, email the line manager and change the password to a random one incase the account is re-enabled.
Neil RussellTechnical Development Lead

Commented:
I can post an article tomorrow detailing exactly how its all done, with the scripts, if you  dont have a full answer by then.
You can open a question to have a script created to do all you need.

From what you are saying I am guessing it would work as below.

1. Check for the destination OU if not present create it
2. Check for the users who meet the criteria if found move to that OU
3. Check users in the destination OU and if more than x days then delete.

You can create the OU anywhere you need to.
Yes the script will move the objects once found based on the logic above.
Yes the script can be created to delete objects in the disabled OU after x days.
Hunter24Office 365 Support Engineer

Author

Commented:
Hi Neilsr
 If you have that article please post it here, it should be a very helpful guide in this process. Please note that Users and Computers ARE NOT  in the same OU as you explained. Under the domain tree there is a separate OU for each.

Hi becraig:

You got it! Points 1-3 in your answer is exactly what I need! Should I open a SEPARATE question for this script?Please advise. Thanks.
I would suggest that, in the powershell zone.

Though I can write it pretty quickly there are a lot of other experts who can contribute and get you the most efficient path.
Hunter24Office 365 Support Engineer

Author

Commented:
becraig:

I followed your recommendation and have just opened a new question in the powershell zone.
Great I'll take a look, I'm sure one of the guys might have already provided a solution by now.
Hunter24Office 365 Support Engineer

Author

Commented:
Thanks to both for your support, I'm using the AD Tidy app, it has helped me a lot.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial