CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2010
    Posts
    5

    How to get all user account info in C# (windows VISTA/7)??

    Hey guys,

    is there a way to get the information (username, home directory, user group, ...) from every user account on a windows machine (VISTA / 7). I'm running the program as an Administrator so rights shouldn't be a problem.

    Ofcourse the passwords aren't needed.

    Thanks in advance!!!

    PS: I'm not that great of a programmer , so some example code would be sweet!

  2. #2
    Join Date
    Feb 2010
    Posts
    5

    Re: How to get all user account info in C# (windows VISTA/7)??

    Because I can't seem to find an edit button I'll post this in another post:

    I'm using visual studio 2008 so C#.net 3.5

  3. #3
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: How to get all user account info in C# (windows VISTA/7)??

    I know only the method that uses WMI
    http://www.codeproject.com/KB/cs/enu...tem_users.aspx
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  4. #4
    Join Date
    Feb 2010
    Posts
    5

    Re: How to get all user account info in C# (windows VISTA/7)??

    thanks but I tried this and it says I don't have the valid namespace while I'm sure I do...

  5. #5
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: How to get all user account info in C# (windows VISTA/7)??

    the compiler usually knows better so maybe show us your code?
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  6. #6
    Join Date
    Feb 2010
    Posts
    4

    Re: How to get all user account info in C# (windows VISTA/7)??

    I thinks you should add using System.Management;
    and add reference System.Management to your project.

  7. #7
    Join Date
    Feb 2010
    Posts
    5

    Re: How to get all user account info in C# (windows VISTA/7)??

    Quote Originally Posted by memeloo View Post
    I know only the method that uses WMI
    http://www.codeproject.com/KB/cs/enu...tem_users.aspx
    Thank you, this was amazing help and it worked.

    I only now need to find how I can get a user's group, because that doesn't seem to be an option like "name" or "fullname" with WMI.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured