Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to fetch all user's windows account name in a network related environment using C# .net? I am using C#2.0.

I could get the logged in user's windows account name as follows:

lblUserName.Text = System.Windows.Forms.SystemInformation.UserName.ToString();

I want the list of all users with their windows account name.
Posted

1 solution

To retrieve the list of all users in an Active Directory domain in .NET 2.0, you'll need to use the System.DirectoryServices assembly / namespace[^].
Get List of Active Directory Users in C#[^]

If you can upgrade to .NET 3.5 or higher, the System.DirectoryServices.AccountManagement assembly / namespace[^] provides a simpler API for doing the same thing.
Using System.DirectoryServices.AccountManagement[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900