Detect if user is using Terminal ServerTag(s): WinAPI/Registry
About cookies on this site
We use cookies to collect and analyze information on site performance and usage,
to provide social media features and to enhance and customize content and advertisements.
[external function declaration]
FUNCTION Integer GetSystemMetrics (Integer nIndex) LIBRARY "user32.dll"
[powerscript]
integer SM_REMOTESESSION = 4096 // remote session
integer SM_REMOTECONTROL = 8193 // remote control
IF GetSystemMetrics(SM_REMOTESESSION)> 0 THEN
// on terminal server
END IF
Another way is to check the Windows environment variable sessionname.
The value of this environment variable will be 'Console' for a normal, local session.
For an Remote Desktop session it will contain the phrase 'RDP'.