Windows Scripting
  Home arrow Windows Scripting arrow Moving and Renaming Computers with Active ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Moving and Renaming Computers with Active Directory
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-01-17

    Table of Contents:
  • Moving and Renaming Computers with Active Directory
  • Moving a Computer to a New Domain
  • Renaming a Computer
  • Add or Remove a Computer Account from a Group

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    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

    1. Open the ADUC 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 window, right-click on the computer and select Move.
    7. Browse to and select the new parent container or OU.
    8. 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

    More Windows Scripting Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "Active Directory Cookbook, Second...
     

    Buy this book now. 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.

    WINDOWS SCRIPTING ARTICLES

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT