DirectoryEntry problem with Credentials (No Impersonation) RRS feed

  • Question

  • User-2127281037 posted

    I’m using DirectoryEntry to access Active directory inside my Company.
    We have 2 OrganizationUnit OU1 and OU2.
    We have 2 uers:

    • User1 is enabled for OU1
    • User2 is enabled both for OU1 and OU2.

    I’m logged in Windows with User1, and I need to use User2 to get from Active Directory the list of the Company Users, including both OU1 and OU2.
    I’ve used DirectoryEntry constructor with Username, Pwd and AuthType, where I pass User2,
    public DirectoryEntry (string path, string username, string password, System.DirectoryServices.AuthenticationTypes authenticationType);

    I expected to acquire User2 credentials for getting Users of both the Organization Units, but I continue to retrieve only users for OU1.
    I’ve tried also differenct combination for parameter authenticationType but nothing has changed.
    Have you any suggestion?
    Best regards,

    Friday, May 29, 2020 2:38 PM

All replies

  • User-2127281037 posted

    I've found a solution impersonating User2 before of invoking the DirectorySearcher.FindAll(), https://www.codeproject.com/Articles/10090/A-small-C-Class-for-impersonating-a-User

    Is there another way to do the same thing without impersonating User2?

    Thank you,


    Friday, May 29, 2020 9:09 PM