Enumerate RDP Sessions on a Windows Server
July 10, 2012To enumerate existing RDP sessions on your local host, simply use the qwinsta command.
You can also specify a server name or ip address for a remote machine: e.g. qwinsta /server:10.5.2.44
If you want to log off any of these session (assuming your have the required privileges) you can use the command rwinsta, which additionally accepts the name or id of a session.
If you run e.g. rwinsta 2 /server:10.5.2.44 and then enumerate the existing sessions again, the session with id 2 has disappeared.