I came across a situation when testing pushing re-images out with SCCM where I needed to ensure that the old computer object had been moved to the new OU that I specified. This is because even though I specified what OU I wanted the computer to be moved to during the “Apply Network Settings” task, the computer object wasn’t moved because the object already existed. I downloaded and modified Jakob’s vb script MoveOU.vbs which accepts the target OU as an argument.
The caveat with this script is that that since it needs to be run with an AD account that has rights to move the computer object, it cannot be run while the PC is in the PE, so it has to be run after the computer has been sysprepped and has booted from the OS that was dropped to the disk. Not a big deal, since we want the script to be successful even on new images where there isn’t an existing computer record. Here is an example command line usage:
MoveOU.vbs “OU=Marketing Department,OU=Workstations,DC=CONTOSO,DC=COM”
5 thoughts on “Change a Computer’s OU during an OSD Task Sequence”
What version of SCCM is this? I cant find anything in 2012 to allow me to specify the credentials within the task sequence. It seems that 2012 runs as the local system account (with admin privs – per the checkbox), but I cant find a way to specify which account will run a specific task or a specific package’s program within the task sequence.
Any info would be extremely helpful!
This is easily done as described by Jesper Valdgaard here on
Just follow the guide here
And how to implement in a Task Sequence
Further testing in my lab confirmed, if you put the sub OU first, then the parent OU it works, this is the correct format for the LDAP path. On the other hand, if you put the Parent OU, then Sub OU after it fails, I just went to the property of the sub OU and looked at the Attribute Edited and copied and pasted out the Distinguished Name so I would not have to type it out, and it was not in the order I was expecting, this is why in my testing it was working for one OU that did not have a sub. Hope this helps you get your OU move automated successfully!