Is there a way to list all currently logged in users in Active Directory (ADAM) using C#?
2 Answers
Almost certainly not. Active Directory does not maintain a logon-state record.
Based on your other question, you may be able to compare logon/logoff times and guess at the active logged on user. But even this will be just a guess. You might consider something such as a query of the client computer directly using WMI for the logged on user. Users can end an active logon session without a log off event -- think program termination, standby, reset, forced power cycle.
-
1I tried researching how to do this before (in other languages)...getting an accurate record for something like this is surprisingly difficult with Windows. Jun 3, 2011 at 12:39
-
how can I get logged in user IP address using AD? AD give lastLogonTimeStamp but not IP address for the user Oct 23, 2018 at 14:19
ADAM is an authenticaion provider, so the only auditing capabilities are around who has been querying ADAM. Think of it like an ID badge. You don't query the badge to see what doors it's opened, you query the doors to see what badges opened them.