title: Detecting execution into TerminalServer and environment variables
body: <p>I'm trying to use the environment variable SESSIONNAME to detect if we are executing inside a TerminalServer session. The method <code>Environment.GetEnvironmentVariable("SESSIONNAME");</code> is returning <code>RDP-Tcp#0</code> but when I check the environment variables with <code>SET</code> I cannot see that environment variable.</p>
  
  <p>See the following screenshot:</p>
  
  <p><img src="https://i.stack.imgur.com/1Jp4E.png" alt="enter image description here"></p>
  
  <p>Somebody has an idea of what's going on? Or maybe I should try to detect the TerminalService hosting in another way?</p>
  
  <p>Thanks in advance.</p>