Move computer to different OU when software installs have finished.
I have PDQ deploy set to install a base line of apps when a computer is recognized in the Computers OU. Is there a way to automate them to be moved to a different OU once all of the software has successfully completed? A powershell script would be helpful if that is the best way to handle it.
1
Comments
Tony,
Here is how I would do it:
You can do this by doing a foreach-object loop and within that running get-adcomputer and pipe that into move-adobject.
You can read more about how to do this in PowerShell here: https://devblogs.microsoft.com/scripting/the-easy-way-to-use-powershell-to-move-computer-accounts/
I will say that you really should not run this scheduled task as a domain administrator, which would be most people's first instinct. You should have an account (probably a Managed Service Account) do this that has only the permissions that it needs to run this job and nothing else. The MSA will need to have permissions to manage computer accounts in both the "Computers OU" and the new OU. It will also need permissions to read wherever you are placing the CSV file that PDQ's auto report generates.
Hello it is very easy:
Please use this PowerShell cmd for the job as a next step after installation
Move-ADObject -TargetPath 'WriteDownThePathAddress'
Be aware that you need a Import-Module ActiveDirectory and Remote Server Administration Tools for Windows 10 installed if your PDQ is on your local computer.
Ok, thanks for the info. I'll give it a try.