Share via


Active Directory Current Domain Technology Sample

This sample demonstrates how to connect to the currently logged-in domain using an LdapConnection. 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 Exceptions\CS directory.

  2. Type msbuild printdomain.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 printdomain 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 application issues a RootDSE search to the currently logged-in domain to find the fully qualified domain name, and displays it as shown in the following example:

Your domain is: dcName.domainName.xyz.fabrikam.com