Re: Accessing SAM database using C#

From: Marc Scheuner [AD MVP] (m.scheuner_at_inova.SPAMBEGONE.ch)
Date: 05/13/03

  • Next message: Marc Scheuner [AD MVP]: "Re: Authenticate in SAM database..."
    Date: Tue, 13 May 2003 09:48:09 +0200
    
    

    >I want to search for a user account that is stored in local or domain
    >SAM database, I have been able to search against Active Directory but would
    >like to be able to do the same against the SAM database using the
    >System.DirectoryServices namespace?
    >
    >Can anyone provide me with a sample or tell me why the following does not ?
    >
    >string nameContext =
    >dirRoot.Invoke("GET","defaultNamingContext").ToString();

    You're mixing two concepts here - the "defaultNamingContext" is a
    property of the GC / LDAP world - you won't have access to that
    through WinNT. There is no "defaultNamingContext" in WinNT.

    The WinNT world is flat - you have a server, with a bunch of users and
    groups - that's it - no hierarchy, no naming contexts, nothing like
    that. If you want to search, you'll probably just have to bind to
    "WinNT://<local machine name>" as the base path, and then specify what
    you want to search for. Not quite sure how you have to set up the
    filter - usually, that's an LDAP filter which has to be conformant to
    the LDAP search syntax (something like

    (&(samAccountName=<someName>)(objectClass=user))

    But again - since you're not using the LDAP provider, this probably
    won't work....

    Marc

    ================================================================
    Marc Scheuner May The Source Be With You!
    Bern, Switzerland m.scheuner(at)inova.ch


  • Next message: Marc Scheuner [AD MVP]: "Re: Authenticate in SAM database..."