Windows Scripting
  Home arrow Windows Scripting arrow Modifying Computer Objects with Active Dir...
Iron Speed
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
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

Modifying Computer Objects with Active Directory
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2008-01-31

    Table of Contents:
  • Modifying Computer Objects with Active Directory
  • Finding Computers with a Particular OS
  • Binding to the Default Container for Computers
  • Changing the Default Container for Computers
  • Listing All the Computer Accounts in a Domain
  • Identifying a Computer Role

  • 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
     
     
    Iron Speed
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Modifying Computer Objects with Active Directory
    (Page 1 of 6 )

    In this conclusion to a four-part series on how Active Directory handles computers, you will learn how to modify the attributes of a computer object, change the default container for computers, 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.

    Modifying the Attributes of a Computer Object

    Problem

    You want to modify one or more attributes of a computer object.

    Solution

    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: 

      a. Right-click on ADSI Edit in the right pane and click “Connect to....”

      b. Fill in the information for the naming context, container, or OU you want to add an object to. Click on the Advanced button if you need to enter alternate credentials.

      c. In the left pane, browse to the container or OU that contains the computer object you want to modify. Once you’ve found the object, right-click on it and select Properties.

    3. Right-click the attribute you want to modify and select Edit.

    4. Enter the new value and click OK.

    5. Click Apply, followed by OK.

    Using a command-line interface

    Create an LDIF file called modify_object.ldf with the following contents:

      dn: <ComputerDN>
      changetype: modify
      add: <AttributeName>
      <AttributeName>: <AttributeValue>
      -

    Then run the following command:

      > ldifde -v -i -f modify_object.ldf

    To modify an object using AdMod, you’ll use the following general syntax:

      > admod –b <ComputerDN> <attribute>:<operation>:<value>

    For example, you can add a location to a computer object using the following syntax:

      > admod -b cn="Fin101,cn=Computers,dc=rallencorp,dc=com"
      location::"Berlin, Germany"

    Using VBScript

      ' The following code will modify the location attribute
      ' of a computer object.
      Set objComputer = GetObject ("LDAP://<ComputerDN>")

      objComputer.Put "Location" , "<NewLocationValue>"
      objComputer.SetInfo

    Discussion

    Like all objects within Active Directory, computer objects have various attributes that can be queried, modified, and deleted during the day-to-day management of your domain. Because computer objects inherit from the user class, they include similar informational attributes to the user objects, as well as attributes that are specific to computer objects, including:

    1. Location
    2. Description
    3. operatingSystemVersion
    4. operatingSystemServicePack
    5. sAMAccountName
    6. pwdLastSet
    7. primaryGroupID

    See Also

    Recipe 8.10 for finding inactive or unused computers, Recipe 8.13 for finding computers with a particular OS, and MSDN: Computer System Hardware Classes [WMI]

    More Windows Scripting Articles
    More By O'Reilly Media


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

    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

    - VBScript: Array Functions
    - VBScript: Strings, You Can`t Function withou...
    - VBScript: More String Functions
    - VBScript: Functioning with Strings
    - Working with the Windows Registry in C++
    - Understanding Objects
    - HTML Applications: Giving WSH a User Interfa...
    - Modifying Computer Objects with Active Direc...
    - Logon Script to Send Email Notifications
    - Securing Computers and Active Directory
    - Moving and Renaming Computers with Active Di...
    - Working with System Processes in WSH
    - Active Directory and Computers
    - WCF and Proxies
    - Metadata and WCF Essentials




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway