Active Directory Domain Controller Technology Sample

This sample locates domain controllers and global catalogs in the current domain and forest. This sample is available only in Visual C#.

For information about using the samples, see the following topics:

To build the sample

  1. Open a Command Prompt window and navigate to the DomainController\CS directory. For information about required settings and the SDK Command Prompt, see How to: Set Sample Settings.

  2. Type msbuild domaincontroller.sln at the command line.

To run the sample

  1. Navigate to the directory that contains the built executable file, using the command prompt.

  2. Type DomainController and press Enter.

NoteNote

This sample is a console application. You must start and run it in a Command Prompt window to view its output.

Remarks

The sample defines the following methods.

Method Description

GCSample

Finds a global catalog in the current forest and lists its roles and partitions.

DCSample

Finds the following domain controller services:

  • A domain controller within the current domain.

  • The domain controller for a specified site. Change the siteName variable to the specified site.

  • The Key Distribution Center (KDC) in the current domain.

This sample lists their site names, global catalog, and other values.