There are several ways to get this list, like WMI (windows media instrumentation).
But here I will use a different way, let's read the registry and list the win user list.
string users_reg_key=With using this registry key, we can have all users who login into that os. Let's write a simple function to read this registry key in C#.
public string ListWinUsersList()And now we get a string array filled with windows users list.
//The registry key for reading user list.
RegistryKey key =
if (key != null && key.ValueCount > 0)
winusers = key.GetValueNames();