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..."

    Relevant Pages

    • Re: display the OU for a specific User
      ... Some info on LDAP vs. WinNT: ... Microsoft MVP Scripting and ADSI ... >> In general, when you have the distinguished name of the user object, you ...
      (microsoft.public.windows.server.scripting)
    • Re: display the OU for a specific User
      ... Thanks for your help,but the problem is I had been using Winnt provider,so ... I have to either switch to LDAP or Winnt provider.Also as I am new to ADSI ... user, then binds to this user object in Active Directory, then binds to the ...
      (microsoft.public.windows.server.scripting)
    • Active Directory-LDAP-ADSI User management
      ... in windows domain(using ADSI interface) using "WinNT". ... dont know how i activate LDAP in Windows 2000 Server. ...
      (microsoft.public.win32.programmer.networks)
    • Re: How to read users in Local Admin group on remote machine?
      ... > the WINNT provider but i can't use a directorysearcher against WINNT only ... > LDAP, this seems like such an easy thing to do but i haven't had any luck. ... want to run a directory server on any of your workstations don't you;-)) ...
      (microsoft.public.dotnet.general)
    • RE: Searching an AD security group
      ... Here is a link about how to use DirectoryService to list the members of ... it use WINNT, but the LDAP will use the similar ...
      (microsoft.public.dotnet.languages.vb)