I am searching for a simple command to see logged on users on server. I know this one :
Get-WmiObject -Class win32_computersystem
but this
In search of this same solution, I found what I needed under a different question in stackoverflow: Powershell-log-off-remote-session. The below one line will return a list of logged on users.
query user /server:$SERVER