You need to retrieve a list of all users on the current computer or on a network domain.
Perform a query using the Win32_UserAccount or Win32_Group Windows Management Instrumentation (WMI) class.
The Microsoft .NET Framework doesn’t include any classes that allow you to retrieve a list of Windows accounts. However, there’s no need to delve into the intricacies of the Win32 API—instead, you can access this information by performing a simple WMI query.
To use the WMI objects, you must import the System.Management namespace and add a reference to the System.Management.dll assembly. You can then retrieve a list of users by domain, by computer name, or by using a combination of ...