Moving Computer Accounts Using PowerShell
In this article, I posted a script that I use for generating a monthly report of inactive computer accounts in Active Directory.
Once I have reviewed that report and decided which computer accounts I want to get rid of, I like to move them to a “holding cell” OU for a week or so before finally deleting them. I copy the list of inactive computers to an Excel spreadsheet and create a quick and dirty script for moving them en masse using this command:
Get-QadComputer <computername>| Move-QadObject -NewParentContainer ‘domain.com/holding-cell’
Once that’s done, it’s a simple matter to select and disable all of the accounts in that OU using Active Directory Users and Computers. When I get around to automating this move and delete, I’ll post that script too.