4

I'm writing C# program that used on desktop or server os. And I need to know that the current user is working via RDP. How can I get this information?

Artyom
  • 145
  • 1
  • 1
  • 8
  • You may be able to get some ideas here - but this will mean creating your own interfaces to these ideas: http://superuser.com/questions/528737/is-there-a-way-to-determine-if-a-user-logged-in-via-remote-desktop – rhughes Mar 22 '16 at 14:53
  • Possible duplicate of [Detecting remote desktop connection](http://stackoverflow.com/questions/973802/detecting-remote-desktop-connection) – Panda Mar 22 '16 at 14:57

1 Answers1

1

The system variable %sessionname% will return Console if its local or RDP* if its remote.

isRDP = [System.Environment]
    .GetEnvironmentVariable("SESSIONNAME").StartsWith("RDP-")
Pedro G. Dias
  • 3,162
  • 1
  • 18
  • 30