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

3 comments
Date Votes
  • Tony,

    Here is how I would do it:

    1. Have an auto-report in PDQ that dumps a list of computers that have installed the software into a CSV file somewhere.
    2. Have a scheduled task that launches a powershell script. The script should iterate through that CSV file and move each one to the new OU.
      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.

    1
  • 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.

    0
  • Ok, thanks for the info.  I'll give it a try.

    1

Please sign in to leave a comment.

Didn't find what you were looking for?

New post