Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 708155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:21:34+00:00 2026-05-14T04:21:34+00:00

If I do a query (I plan to use SDS.P) against the global catalog,

  • 0

If I do a query (I plan to use SDS.P) against the global catalog, what should the starting path be so I can search the entire GC?

I want to enumerate all users in GC, for example.
Let’s say my gc has users for 3 domains (one parent, two children):

TEST.COM
   ONE.TEST.COM
   TWO.TEST.COM

and i’m on a computer in ONE.TEST.COM. I do not want to hardcode DC=XXX,DC=yyy, I would like to determine that at runtime.

TIA!
-Will

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:21:34+00:00Added an answer on May 14, 2026 at 4:21 am

    Here’s an example function that queries the global catalog:

    class Program
        {
    
            static void Main()
            {
    
                DirectoryEntry entry = new DirectoryEntry("GC://dcserver.domain.local",
                                                           "utility",
                                                           "somepassword",
                                                           AuthenticationTypes.Secure );
    
                const string searchString = "(&(objectCategory=person)(objectClass=user))";
    
                DirectorySearcher searcher = new DirectorySearcher(entry, 
                                                                   searchString, 
                                                                   new string[] { "sAMAccountName", "cn" } );
    
                SearchResultCollection resultCollection = searcher.FindAll( );
    
                foreach ( SearchResult result in resultCollection )
                {
                    Console.WriteLine( result.Path + "\n" + 
                                       result.Properties["cn"][0] + "\n" + 
                                       result.Properties["samaccountname"][0]  );
                }
    
                Console.ReadLine( );
    
            }
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to build a query that will use the non-clustered indexing plan on
Query parameters : http://example.com/apples?order=random&color=blue Matrix parameters : http://example.com/apples;order=random;color=blue When should one use query parameters
I plan to use dojo.query to get some elements by their name attribute from
How do conditional statements (like IF ... ELSE ) affect the query execution plan
I plan to use dom4j DOM Document as a static cache in an application
I'm designing a database schema, and I'm wondering what criteria I should use for
Postgres Full Text Search performance seems to depend on the dictionary you use, here's
(Note: This was formerly titled How do a query plan's estimated executions/IO/CPU/Executions, etc, influence
I don't wish to use authentication with my sync adaptor Since I plan to
I have a complex query that I need to use in a subsequent query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.