I'm trying to use the environment variable SESSIONNAME to detect if we are executing inside a TerminalServer session. The method Environment.GetEnvironmentVariable("SESSIONNAME");
is returning RDP-Tcp#0
but when I check the environment variables with SET
I cannot see that environment variable.
See the following screenshot:
Somebody has an idea of what's going on? Or maybe I should try to detect the TerminalService hosting in another way?
Thanks in advance.