Use C# to get windows user accout detail information

Answered Use C# to get windows user accout detail information

  • Friday, March 28, 2008 3:39 AM
     
     

    Hi everyone:

        What I want to do is shown in subject, but when  I do a lot of search on google, that found out two ways can set or manage the specified accout: use windows net command and DirectoryEntry class, but the two ways just can manipulate account you specified, how can read all windows user accout first and then manage them?

        if a short code that can read all windows user accout details(eg:group) is given it will be nice

All Replies

  • Friday, March 28, 2008 3:50 AM
     
     

    Using the DirectoryEntry class will let you get at all the users and manage them also.  It all depends on what permissions the account that you use with the DirectoryEntry has.  If you are in a doamin and the account that you use for the DirectoryEntry is a domain admin, they you can manage completely all the users within the domain.

     

     

  • Friday, March 28, 2008 5:11 AM
     
     

    Hi Hohn hidey:

        Thank you to replay my thread first. Well but could you give me some more details? which method can I get all user accout information.or give me a simple code, I'm a newer of C# . Thanks again.

  • Friday, March 28, 2008 6:21 AM
     
     

    Dear,

     

      Here is a fantastic article that would help you in find various user credentials or information for a Windows User:

     

    http://www.c-sharpcorner.com/UploadFile/rmcochran/async_ad09302007093117AM/async_ad.aspx

     

    Hope this solves your problem completely Smile

     

  • Friday, March 28, 2008 6:59 AM
     
     
    Using the new System.DirectoryServices.AccountManagement library seems likes the easiest way to go.. (If you're lucky enough to have .Net 3.5)

  • Friday, March 28, 2008 7:10 AM
     
     

    Hi Sandeep A:

        Thanks very much for your article, however there is another question puzzled me: the article you commeded just solve the problem of how to get all groups in a system, but how can I get all user accout in each group? all I want are: all groups in a system(solved by the article), all accouts in each group, and accout related information(if it can be get).

        That is definitly a good article  which use Asynchronous Multi-Threaded technology. I learned a lot thanks again.

  • Friday, March 28, 2008 7:17 AM
     
     Answered
  • Friday, March 28, 2008 7:25 AM
     
     

    Sandeep A:

          I test some code in the article but the result is not what I want, God!

  • Friday, March 28, 2008 7:30 AM
     
     

    hey timvw:

        unfortunately I am using .NET2.0+VS2005

  • Friday, March 28, 2008 8:33 AM
     
     

    You are genius!! Thanks very very much