List local windows users with Forms c#

Asked

Viewed 99 times

0

Good users!

I created an application to create windows users local in bulk, got help here from some users was ball show, but I’m in a little trouble now:

i need to make a condition where I before calling the method for creating users, I want to check if the user already exists. I’ve done a lot of research and I haven’t been successful. Thanks in advance.

  • Post the code you think is pertinent.

  • @Vik I have no idea the code yet, to make this listing.

1 answer

1

I changed a code information I have to list Groups and it worked, I will post here so that other people who have the same problem.

DirectoryEntry machine = new DirectoryEntry("WinNT://" + Environment.MachineName + ",Computer");



var results = machine.Children.Cast<DirectoryEntry>().Where(r => r.SchemaClassName == "User").OrderBy(r => r.Name);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.