You want to move some or all of the objects in an OU to a different OU. You may need to do this as part of a domain restructuring effort.
Open the Active Directory Users and Computers snap-in.
If you need to change domains, right-click on “Active Directory Users and Computers” in the left pane, select Connect to Domain, enter the domain name, and click OK.
In the left pane, browse to the OU that contains the objects you want to move and click on it.
Highlight the objects in the right pane you want to move, right-click on them, and select “Move.”
Browse to the parent container you want to move the objects to, click on it.
Press F5 to refresh the contents of the OU. If objects still exist, repeat the previous three steps.
> for /F "usebackq delims=""" %i in (`dsquery * "<
OldOrgUnitDN>" -scope onelevel`)[RETURN] do dsmove -newparent "<
' This code moves objects from the "old" OU to the "new" OU ' ------ SCRIPT CONFIGURATION ------ strOldOrgUnit = "
<OldOrgUnitDN>" ' e.g. ou=Eng Tools,dc=rallencorp,dc=com strNewOrgUnit = "
<NewOrgUnitDN>" ' e.g. ou=Tools,dc=rallencorp,dc=com ' ------ END CONFIGURATION --------- set objOldOU = GetObject("LDAP://" & strOldOrgUnit) set objNewOU = GetObject("LDAP://" & strNewOrgUnit) for each objChildObject in objOldOU Wscript.Echo "Moving " & objChildObject.Name objNewOU.MoveHere objChildObject.ADsPath, ...