Reputation: 61971
How do I find out what user, if any, is currently logged on to some remote Windows XP machine interactively? .NET code would be great or any command-line utility that I can call from code. SysInternals psloggedon, as suggested on SuperUser, almost works, but it doesn't tell me which session is interactive.
Upvotes: 2
Views: 715
Reputation: 11421
I think you should be able to use the Remote Desktop Services API. WTSOpenServer + WTSEnumerateSessions + WTSQuerySessionInformation. Of course this won't work if the Terminal Services service isn't running, but I don't know of another way to get this information.
Upvotes: 1