Powershell script to see currently logged in users (domain and machine) + status (active, idle, away)
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