Mike Pateras
Mike Pateras

Reputation: 15015

Windows 7: How can I get a list of all Windows user names in .Net?

Is there a simple way to get the names of all the user names of a local Windows 7 machine using .Net? So if I had a machine named MyPC, and it had 3 users MyPC\Mike, MyPC\Bob, and MyPC\Steve, I'd just want to be able to query to get Mike, Bob, and Steve. Of course, I don't care if they have the computer name attached, or not, as well.

Upvotes: 3

Views: 2206

Answers (2)

Program.X
Program.X

Reputation: 7412

If no-one comes up with a better way, you could enumerate the \Users folder and use the folders in there as representations. (Providing each user has logged in and the network isn't using roaming profiles)

Upvotes: 2

Related Questions