Run QWINSTA to extract the RDP session information
- QWINSTA /SERVER:servername
If the session exists, read the username and session ID.
- To disconnect user
- To log-off user / kill the session
Ref : http://discoposse.com/2012/10/20/finding-rdp-sessions-on-servers-using-powershell/