How to determine if the current user is registered through Terminal Services in .NET?

I would like to determine from a .NET application whether the current user (from System.Environment.UserName) will log on to the machine physically or through Terminal Services.

A use case is to launch a launcher. When I enter the local development machine, I usually like to run many applications (Outlook, various notification applications), but when I use terminal services to connect, it usually means that I call and solve the problem, and I want my the system was ready to work as soon as possible.

I assume this is possible through WMI, but I am not familiar with classes or queries to do this.

+3
source share
1 answer

Source: https://habr.com/ru/post/1725725/


All Articles