Is there any way I can detect if remote desktop is enabled on windows xp/vista/7. I know that you can access the session information using performance counters but what I really need is a enabled/disabled flag?
PerformanceCounter performanceCounter = new PerformanceCounter("Terminal Services", "Active Sessions");
Thanks
If you’re trying to see if you’re running under a Terminal server session, the easiest way is to check SystemInformation.TerminalServerSession. This returns true if you’re application is associated with a terminal server session.
To see if remote desktop is enabled at all, just check for whether the Terminal Services service is running, using a ServiceController.