I would like to determine, from a .NET application, whether the current user (from System.Environment.UserName) is logged in to the machine physically, or via terminal services.
The use case is a startup program launcher. When I m logging on to my development machine locally I would normally like a host of applications to be started automatically (Outlook, various notification area apps) but when I m using terminal services to connect, it usually means I m on call and dealing with an issue, and I want my system ready to go as soon as possible.
I m guessing this is possible via WMI but I m not familiar with the classes or queries to get it done.