15.11. Moving an Object


You want to move an object to a different container or OU in the same domain.


Using a graphical user interface

  1. Open ADSI Edit.

  2. If an entry for the naming context you want to browse is not already displayed, do the following:

  3. Right-click on ADSI Edit in the right pane and click Connect to....

  4. Fill in the information for the naming context, container, or OU where the object is currently. Click on the Advanced button if you need to enter alternate credentials.

  5. In the left pane, browse to the container or OU that contains the object you want to modify. Once you've found the object, right-click on it and select Move.

  6. Browse to the new parent of the object, select it and click OK.

Using a command-line interface

> dsmove "<ObjectDN>" -newparent 

Using VBScript

' This code moves an object from one location to another in the same domain.
strNewParentDN = "LDAP://<NewParentDN>"
strObjectDN    = "LDAP://cn=jsmith,<OldParentDN>"
strObjectRDN   = "cn=jsmith"
' ------ END CONFIGURATION ---------
set objCont = GetObject(strNewParentDN)
objCont.MoveHere strObjectDN, strObjectRDN


Using a graphical user interface

If the parent container of the object you want to move has a lot of objects in it, you may want to add a new connection entry for the DN of the object you want to move. This may save you time searching through the list of objects in the container. You can do this by right-clicking ADSI Edit and selecting ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.