January 24, 2013

How to tell if the current session is a Remote Desktop session

Filed under: Automation,Scripting — Marcus Tettmar @ 10:51 am

Here’s a small piece of code which will tell you whether the current session is a Remote Desktop/Terminal Services session or not:

Let>SM_REMOTESESSION=4096
LibFunc>User32,GetSystemMetrics,isRemote,SM_REMOTESESSION
If>isRemote>0
    MessageModal>Current Session is RDP/Terminal Services Session
Else
    MessageModal>Current Session is Local Session
Endif