Hi,
I am currently using the Microsoft Platform connector to monitor a few terminals and would like to know whether it is possible to return the named users currently logged on to the terminals.
I believe this is currently not implemented in the Microsoft Platform connector. However this info should be available to retrieve via WMI. There's a class "win32_ComputerSystem" that returns a parameter "Username" that shows what user is logged on at the moment.
https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-computersystem
This is something that could be implemented in the connector.
Hi,
Maybe another option is to use the command:
query user
Checking the documentation available at Microsoft, this command is valid for Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/query-user
It is true that it is not a WMI query, but it could be an option in case we don’t find a WMI query that works for all Windows OS.
I further investigate this: this UserName property returned with the Win32_ComputerSystem returns the name of the user that is physically sitting at the computer. If nobody is sitting at the computer, but logs in through remote desktop then the UserName property will be empty. When I checked the Win11 I was physically sitting at it, when I checked the Win2019 I was connected via remote desktop which explains what I was seeing. Remote desktop to Win11 also gives an empty Username.
To summarize:
-If you only want to know who is logged in that is physically sitting at the computer (looking at that screen, using the keyboard and mouse attached to that computer) then Win32_ComputerSystem, UserName can be used.
-If you want to know everyone that is logged in to that computer (both physically and remote desktop sessions) then this can be derived from the queries that I’ve written in my answer
I tested this with Windows Server 2019 Standard and there the UserName stays empty. Under Windows 11 it is being filled in. Seems like that property is not filled in in all cases.