c++ , windows 2000 - Remotely get locally logged username
Posted on 2007-10-03
I'm currently trying to remotely find who is locally logged into windows 2000 workstations. I have tried a couple of wmi methods: Reading the UserName property of the Win32_ComputerSystem object; and running the GetOwner() method of the Win32_Process object associated with the explorer.exe process. Both of these methods work fine with windows XP, and on *some* of my windows 2000 workstations.
I am aware of using NetWkstaUserEnum to get logged on users, but that lists all logged on users, including any batch processes running, which is not what I want.
If someone knows of a good way to find just the locally logged on user, some reasoning on why the WMI methods would work on some windows 2000 workstations and not others, or a way to narrow NetWkstaUserEnum down to just the locally logged in user I would be very greatful.