This topic shows how to enumerate all users, in a local security database, on member servers and computers running on Windows 2000 Professional.
To enumerate the users
- Bind to the computer using the following rules:
- Use an account that has sufficient rights to access that computer.
- Use the following binding string format using the WinNT provider, computer name, and an extra parameter to instruct ADSI that it is binding to a computer: "WinNT://<computer name>,<computer>". The "<computer name>" parameter is the name of the computer for whose groups to access. This parameter instructs ADSI that it is binding to a computer and enables the WinNT provider parser to skip some ambiguity resolution queries to determine what type of object you are binding to.
- Bind to the IADsContainer interface.
- Add "user" to the IADsContainer.Filter property. This causes the enumeration to only contain objects that have the "user" object class.
- Enumerate the objects. For each user object, use the IADs or IADsUser interface methods to read the user properties.
Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
