Share this page 

Detect if running a Citrix session (Windows)Tag(s): IO


The easiest way is to query the environment variable SESSIONNAME. The value starts with ICA... in a Citrix session, RDP if in remote desktop session or Console if directly on a workstation.

public static boolean isRemoteDesktopSession() {

   System.getenv("sessionname").toLowerCase().startsWith("rdp");

}



public static boolean isCitrixSession() {

   System.getenv("sessionname").toLowerCase().startsWith("ica");

}



public static boolean isConsoleSession() {

   System.getenv("sessionname").toLowerCase().startsWith("console");

}