Skip to Content
Active Directory Cookbook
book

Active Directory Cookbook

by Robbie Allen
September 2003
Intermediate to advanced
624 pages
15h 49m
English
O'Reilly Media, Inc.
Content preview from Active Directory Cookbook

6.5. Moving a User

Problem

You want to move a user object to a different container or OU.

Solution

Using a graphical user interface

  1. Open the Active Directory Users and Computers snap-in.

  2. 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.

  3. In the left pane, right-click on the domain and select Find.

  4. Type the name of the user and click Find Now.

  5. In the Search Results, right-click on the user and select Move.

  6. Browse to the new parent container or OU and click on it.

  7. Click OK.

Using a command-line interface

> dsmove "<UserDN>" -newparent "<NewParentDN>"

Using VBScript

' This code moves a user from one container to another.
' ------ SCRIPT CONFIGURATION ------
strUserDN = "<UserDN>"     ' e.g. cn=rallen,cn=users,dc=rallencorp,dc=com
strOUDN = "<NewParentDN>"  ' e.g. ou=Sales,dc=rallencorp,dc=com
' ------ END CONFIGURATION ---------

Set objUser = GetObject("LDAP://" & strUserDN)
Set objOU = GetObject("LDAP://" & strOUDN)
objOU.MoveHere objUser.ADsPath, objUser.Name

Discussion

Moving a user object between OUs in the same domain has no direct impact to the actual user. The only thing to be cautious of is the impact of moving the user to a new OU that may have different security or GPOs applied to it.

See Also

Recipe 4.17 for moving objects between OUs

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Active Directory Administration Cookbook

Active Directory Administration Cookbook

Sander Berkouwer
Active Directory Cookbook, 3rd Edition

Active Directory Cookbook, 3rd Edition

Laura E. Hunter, Robbie Allen
Active Directory Cookbook, 4th Edition

Active Directory Cookbook, 4th Edition

Brian Svidergol, Robbie Allen

Publisher Resources

ISBN: 0596004648Supplemental ContentCatalog PageErrata