다음을 통해 공유


Active Directory Domain Operation Technology Sample

This sample lists information about the current forest, the current domain, child domains, and the domain controller. 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 Domain\CS directory. For information about required settings and the SDK Command Prompt, see How to: Set Sample Settings.

  2. Type msbuild domain.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 Domain 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

This sample demonstrates how to obtain domain information and contains the following methods.

Method Description

ForestSample

Lists the following information in the current forest:

  • Current forest name.

  • All the domains in the forest.

  • Global catalogs in the forest.

  • Role owners in the forest.

DomainSample

Lists the following information in the current domain:

  • Current domain name.

  • All child domains.

  • Domain controllers in the current domain.