Vbscript / Active Directory / Move User-computer-group Between Ous
Move an AD object (User, Computer, Group, Printer etc.) between OUs. Rename the object using the second parameter of the MoveHere method or use vbNullString to retain the existing name.
strComputer = "CN=comp," strSourceOU = "OU=source, DC=domain,DC=local" strDestinationOU = "OU=dest,DC=domain,DC=local"
Set objNewOU = GetObject("LDAP://" & strDestinationOU) Set objMoveComputer = objNewOU.MoveHere("LDAP://" & strComputer & strSourceOU, vbNullString)
Please note that a disclaimer applies to any code on this page.
|