Remotely logoff an RDP session

This is something rarely used, so I thought I’d log it here for reference.

Get the open RDP sessions on the server using qwinsta and make note of the sessionid for the desired connection.

qwinsta /server:<server-name>

use the logoff command and provide the sessionid to logoff that session.

logoff <sessionid> /server:<server-name>