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

5.1. Creating an OU

Problem

You want to create an OU.

Solution

Using a graphical user interface

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

  2. If you need to change domains, right-click on the Active Directory Users and Computers label in the left pane, select Connect to Domain, enter the domain name, and click OK.

  3. In the left pane, browse to the parent container of the new OU, right-click on it, and select New Organizational Unit.

  4. Enter the name of the OU and click OK.

  5. To enter a description for the new OU, right-click on the OU in the left pane and select Properties.

  6. Click OK after you are done.

Using a command-line interface

> dsadd ou "<OrgUnitDN>" -desc "<Description>"

Using VBScript

' This code creates an OU 
' ------ SCRIPT CONFIGURATION ------
strOrgUnit       = "<OUName>"      ' e.g. Tools
strOrgUnitParent = "<ParentDN>"    ' e.g. ou=Engineering,dc=rallencorp,dc=com
strOrgUnitDescr  = "<Description>" ' e.g. Tools Users
' ------ END CONFIGURATION ---------

set objDomain = GetObject("LDAP://" & strOrgUnitParent)
set objOU = objDomain.Create("organizationalUnit", "OU=" & strOrgUnit)
objOU.Put "description", strOrgUnitDescr
objOU.SetInfo
WScript.Echo "Successfully created " & objOU.Name

Discussion

OUs are used to structure data within Active Directory. Typically, there are four reasons why you would need to create an OU:

Segregate objects

It is common practice to group related data into an OU. For example, user objects and computer objects are typically stored in separate OUs (in fact, ...

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