Periodically, I scan our Active Directory (AD) for machines that haven’t contacted AD in 60+ days. So one thing I like to do is stage them in an OU called “Obsolete”, and then wait another 60+ days to remove them from AD.
Our turnover is generally not to high, but it’s enough that moving/removing the devices by hand would take some time.
So I generate my list and then plug it into the little one-liner below:
Get-Content -path ".\computers.txt" | Get-ADComputer | Move-ADObject -TargetPath "OU=Obsolete,DC=domainname,DC=com"
This will move all the computers in the list to the “Obsolete” OU to get ready to be deleted from AD with another script (We’ll go over that one later 🙂 ).
By day, I’m a systems admin for a medium size company in the Pacific Northwest.
By night, I’m a blogger, gamer, and all around general nerd.