Moving and Renaming Computers with Active Directory
(Page 1 of 4 )
In this second part of a four-part series that focuses on how Active Directory treats computer objects, you will learn how to move a computer within the same domain, rename a computer, and more. This article is excerpted from chapter eight of the
Active Directory Cookbook, Second Edition, written by Robbie Allen and Laura E. Hunter (O'Reilly; ISBN: 059610202X). Copyright © 2006 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.
Moving a Computer Within the Same Domain
Problem
You want to move a computer object to a different container or OU within the same domain.
Solution
Using a graphical user interface
Open the ADUC 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, right-click on the domain and select Find.
Beside Find, select Computers.
Type the name of the computer and click Find Now.
In the Search Results window, right-click on the computer and select Move.
Browse to and select the new parent container or OU.
Click OK.
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
You can move a computer object to a new container using the built-in DSMove utility or AdMod. To use DSMove, enter the following syntax:
> dsmove "<ComputerDN>" -newparent "<NewParentDN>"
To move a computer object using AdMod, use the following:
> admod –b "<ComputerDN>" –move "<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 ability to manage the computer object in Active Directory. Also, if GPOs are used differently on the new parent, it could impact booting and logon times, and how the computer’s operating system behaves after a user has logged on.
See Also
Recipe 4.20 for moving an object to a different OU, and Recipe 8.5 for moving a computer to a different domain
Next: Moving a Computer to a New Domain >>
More Windows Scripting Articles
More By O'Reilly Media
|
This article is excerpted from chapter eight of the Active Directory Cookbook, Second Edition, written by Robbie Allen and Laura E. Hunter (O'Reilly; ISBN: 059610202X). Check it out today at your favorite bookstore. Buy this book now.
|
|