Click here to Skip to main content
15,899,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm again attempting to obtain a list of all users on a windows platform.
I already obtained a general user list using the netuserenum function.
I think you do the same with other functions, like NetQueryDisplayInformation.

But my question goes a step further. I want a refined the list of usernames
that appears on the main windows screen. There are so other 'user names', some I do not recognize. What are the refining steps needed to eliminate these unknowns? I guess I could accept the admin and guest(if turned on) if I had to. Thanks again,

What I have tried:

The college of hard knocks and the trial and error methods, and by using examples.
Posted
Updated 29-Apr-24 12:03pm
v2

There is no procedure for filtering the users based on what you don't recognize. User accounts are user accounts. In a corporate domain environment, you can have other users you don't recognize, but you don't have any way of filtering them out based on some special property, other than the names you don't recognize.
 
Share this answer
 
Assuming you're trying to replicate the list shown on the Windows lock screen, it's not as simple as passing a filter to the list.

By default, Windows will show all enabled local user accounts on the lock screen, assuming the computer is not joined to an AD domain.

But you can override that via the registry:
For specifically hiding an account from login screen, use registry:
  • Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon.
  • Create SpecialAccounts sub-key to Winlogon. Then create UserList sub-key to SpecialAccounts.
  • So at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList, at the right pane create DWORD value with name of user account name you want to hide.
  • Set the DWORD value data to 0.

That means your code will need to query the registry to see if any accounts are hidden from the lock screen, as well as checking that the account is enabled.

To further complicate matters, there's a group policy setting to make Windows show the local users list even if the computer is joined to a domain. (Computer Configuration ⇒ Administrative Templates ⇒ System ⇒ Logon ⇒ Enumerate local users on domain-joined computers)

And the lock screen will also show any users who are currently logged in to the computer, whether they are local or domain users.
 
Share this answer
 
Comments
samtoad 12hrs ago    
i found my revisited answer to: ""But my question goes a step further. I want a refined the list of usernames"". I was able to get a little better "refined" list, but with some usernames I didn't recognize.
Thanks to all though.

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