4
votes

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?

1
You may be able to get some ideas here - but this will mean creating your own interfaces to these ideas: superuser.com/questions/528737/… - rhughes
Possible duplicate of Detecting remote desktop connection - Panda

1 Answers

1
votes

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

isRDP = [System.Environment]
    .GetEnvironmentVariable("SESSIONNAME").StartsWith("RDP-")