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

8.4. Moving a Computer

Problem

You want to move a computer 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. Beside Find, select Computers.

  5. Type the name of the computer and click Find Now.

  6. In the Search Results, right-click on the computer and select Move.

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

  8. Click OK.

Tip

With the Windows Server 2003 version of Active Directory Users and Computers you can also use the new drag and drop functionality to move computers and other objects.

Using a command-line interface

> dsmove "<ComputerDN>" -newparent "<NewParentDN>"

Using VBScript

' This code moves a computer to the specified container/OU.
' ------ SCRIPT CONFIGURATION ------
strCompDN = "<ComputerDN>"  ' e.g. cn=joe-xp,cn=Users,dc=rallencorp,dc=com
strOUDN = "<NewParentDN>"   ' e.g. ou=workstations,dc=rallencorp,dc=com
' ------ END CONFIGURATION ---------

set objComp = GetObject("LDAP://" & strCompDN)
set objOU = GetObject("LDAP://" & strOUDN)
objOU.MoveHere objComp.ADsPath, objComp.Name

Discussion

You can move computer objects around a domain without much impact on the computer itself. You just need to be cautious of the security settings on the new parent OU, which may impact a user’s ...

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