Start a new topic
Answered

Logoff sessions

In the app you have connect / disconnect but no logoff? Is this intentional? Mike

Best Answer

Like Patrik mentioned, the remote desktop protocol itself does not support logging off a session. The way MobaXTerm, RDCM, etc. are doing it, is to "reset" the session using the WTS API. There are a couple of issues with this approach:

* it's error prone because in many situations you can use RDP (port 3389) but can't use the WTS API because all high ports (RPC) are basically needed

* it's dangerous because resetting the session is not exactly a log off. It's basically killing the session and unsaved data is lost

* it's fragile because there is not much to identify the correct session. In the WTS API you need to specify the session id you want to kill. Identifying the session by the username/client alone can sometimes lead to the wrong session


You can still use the dashboard tab to reset sessions though.


Hi Mike!


I assume you're referring to the RDP connection type, right? In this case unfortunately logoff is not possible, as - from our current knowledge - there is no official "logoff" support within the RDP protocol available. Sorry!


Regards,

Patrik

Patrik,


How does MobaXterm do it?  They have a menu selection that will logoff and close all open RDP Sessions.

This is surprising to me too.  I have this option in Microsoft's Remote Desktop Connection Manager.

Answer

Like Patrik mentioned, the remote desktop protocol itself does not support logging off a session. The way MobaXTerm, RDCM, etc. are doing it, is to "reset" the session using the WTS API. There are a couple of issues with this approach:

* it's error prone because in many situations you can use RDP (port 3389) but can't use the WTS API because all high ports (RPC) are basically needed

* it's dangerous because resetting the session is not exactly a log off. It's basically killing the session and unsaved data is lost

* it's fragile because there is not much to identify the correct session. In the WTS API you need to specify the session id you want to kill. Identifying the session by the username/client alone can sometimes lead to the wrong session


You can still use the dashboard tab to reset sessions though.

I'm still stunned that logoff isn't an option in what is otherwise a very robust package.  The WTS API provides the WTSLogoffSession command - can't that be used?  Can you provide a means for us to send commands to the remote session, such as CMD.EXE logoff ?  I've tried playing with commands and key sequences but they all seem to run in the local computer and not the remote session.

Hi Andrew,


the dashboard allows you to reset the session (note that unsaved data is lost). The reset button invokes the WTSLogoffSession API. So you can use the dashboard to do that. However, using this API to log off the very same session use in Royal TS is tricky. The WTSLogoffSession requires a session id to identify the session you want to reset/logoff. When you connect to the RDP session using the Microsoft RDP ActiveX control we use in Royal TS, you cannot get the session id. So you need to match the user, computer name to match the session and depending on the terminal service setup, it's possible that this doesn't match the correct session. So it's quite dangerous to do this "automatically" with the information at hand.


Unfortunately there's still no API to send commands through the RDP session - which would be a fantastic feature. I reported this to MS several times in the past years but they never listened :(


Regards,
Stefan

Login or Signup to post a comment