Move computer to different OU when software installs have finished.

Comments

3 comments

  • Luke Nichols

    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
    Comment actions Permalink
  • SevenWishes

    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
    Comment actions Permalink
  • Tony Darsey

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

    1
    Comment actions Permalink

Please sign in to leave a comment.