How list the active users in a windows machine (for whom registry hive has been created) through code (c#/c++)

Anandu Ramachandran 20 Reputation points
2024-01-23T08:58:18.51+00:00

I am looking for a way to list all the user's SID this can be local/domain users that has logged in to the system at a point. I am specifically interested in users accounts that can be actually logged in through UI, the caveat here being that for domain users i only need the account that has already been logged into and a registry inside the USERS hive exists for the particular domain account.

I have already tried NetUserEnum, but i am failing to accomodate all the said conditions into it.

As a workaround i have also found the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList that has the subkeys as these users that i require, but i was intrested in knowing if any documented API or such exisits for the same.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,219 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,358 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,978 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,446 questions
{count} votes

0 additional answers

Sort by: Most helpful