Solved

Auto-Disable inactive Active directory computers

Posted on 2014-03-13
5
443 Views
Last Modified: 2014-03-31
Hi All,

we are an R &D company. we reinstall ( domain join ) computers frequently.
let's say we reinstall and domain join (using different names ) at least 20 machine in a month.
old machines list is growing every month and we have to delete those manually, which is painful.

 
is there any way to tell AD to remove/delete inactive domain joined machines after some days by doing it's own checks !!!



Thanks,
Rafi
0
Comment
Question by:IMGIDC
  • 2
5 Comments
 
LVL 57

Expert Comment

by:Cliff Galiher
ID: 39928450
There is no built-in functionality for this. You could write a PowerShell script and run it as a scheduled task. Or if you have automation software in place (many larger networks do) like System Center, you may be able to do so through that software. A system center runbook, for example.

But by script or by software, it'd be a highly customized solution and not very portable, so you won't likely find a canned script or software package.
0
 
LVL 57

Expert Comment

by:Cliff Galiher
ID: 39928513
Which, to be clear, I did mention 3rd party automation software. It'd be impossible to list all 3rd party tools. There are plenty, some good, some bad, across a spectrum of price points.
0
 
LVL 36

Accepted Solution

by:
Mahesh earned 500 total points
ID: 39928547
Use dsquery to find out inactive computers and pass its output to disable command as below

dsquery computer -inactive 5 -limit 0 -o rdn > C:\inactiveComputers.txt

The above command will list all inactive computers who have not logged since last 5 weeks

Now you can pipe this output to dsmod command to disable those accounts

dsquery computer -inactive 5 | dsmod computer -disabled yes

Above command will disable all inactive computers since 5 weeks
You can create schedule task on PDC server and run it every month once

Mahesh
0
 
LVL 2

Author Comment

by:IMGIDC
ID: 39928649
Thanks Mahesh.

that's really impressive.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question