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.8. Determining How Many Child Objects an OU Has

Tip

This recipe requires the Windows Server 2003 domain functional level.

Problem

You want to determine if an OU has any child objects or determine how many child objects it contains.

Solution

Using a graphical user interface

  1. Open LDP.

  2. From the Menu, select Browse Search.

  3. For Base Dn, enter < OrgUnitDN > .

  4. For Filter, enter (objectclass=*).

  5. For Scope, select Base.

  6. Click the Options button and enter msDS-Approx-Immed-Subordinates For Attributes.

  7. Click OK and Run.

  8. The results will be displayed in the right pane.

Using a command-line interface

> dsquery * "<OrgUnitDN>" -scope base -attr msDS-Approx-Immed-Subordinates

Using VBScript

' This code displays the approximate number of child objects for an OU
set objOU = GetObject("LDAP://<OrgUnitDN>")
objOU.GetInfoEx Array("msDS-Approx-Immed-Subordinates"), 0
WScript.Echo "Number of child objects: "  & _
             objOU.Get("msDS-Approx-Immed-Subordinates")

Discussion

The msDS-Approx-Immed-Subordinates attribute is new to Windows Server 2003. It contains the approximate number of direct child objects in a container or organizational unit. Note that this is an approximation and can be off by 10% of the actual total for large containers. The main reason for adding this attribute was to give applications an idea of how many objects a container has so that it can display them accordingly.

msDS-Approx-Immed-Subordinates is a constructed attribute, that is, the value is not actually stored in Active Directory like other ...

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