Directory Services

Enumerating Application Directory Partitions in a Forest

Like domain partitions, every application directory partition is represented by a crossRef object in the Partitions container of the configuration partition. Each crossRef object stores data about its corresponding partition.

A crossRef object that represents a domain partition is distinguished from a crossRef object that represents a an application directory partition by the contents of the systemFlags attribute. The crossRef object that represents a domain partition will have both the ADS_SYSTEMFLAG_CR_NTDS_NC and ADS_SYSTEMFLAG_CR_NTDS_DOMAIN flags set in the systemFlags attribute. The crossRef object that represents an application directory partition will have the ADS_SYSTEMFLAG_CR_NTDS_NC flag set and the ADS_SYSTEMFLAG_CR_NTDS_DOMAIN flag will not be set in the systemFlags attribute.

The crossRef objects that represent the Schema and Configuration partitions will also have the have ADS_SYSTEMFLAG_CR_NTDS_NC flag set and the ADS_SYSTEMFLAG_CR_NTDS_DOMAIN flag will not be set in the systemFlags attribute. This requires that these two crossRef objects be distinguished by the contents of the nCName attribute. The nCName attribute for the crossRef object that represents the Schema container will be identical to the schemaNamingContext attribute of the RootDSE object. Similarly, the nCName attribute for the crossRef object that represents the Configuration container will be identical to the configurationNamingContext attribute of the RootDSE object.

To identify all application directory partitions in a forest, perform the following steps

  1. In the Partitions container of the configuration partition, search for or enumerate all crossRef objects.
  2. If a crossRef object does not have the ADS_SYSTEMFLAG_CR_NTDS_NC flag set or has the ADS_SYSTEMFLAG_CR_NTDS_DOMAIN flag set in the systemFlags attribute value, exclude the object from the result set.
  3. Exclude the Schema partition from the result set by comparing the nCName attribute of the crossRef object to the schemaNamingContext attribute of the RootDSE object.
  4. Exclude the Configuration partition from the result set by comparing the nCName attribute of the crossRef object to the configurationNamingContext attribute of the RootDSE object.
  5. The remaining crossRef objects in the result set all represent application directory partitions.