I want to disable an app when terminal services start. Is there a way to register with some service that will notify when some logs in remotely?
+2
A:
There is no way to get notified of it but you can periodically check SystemInformation.TerminalServerSession and act accordingly.
However, if your program doesn't work through RDP the people who want to use it remotely will just use VNC. Or TeamViewer. Or other methods. Suffice to say that I consider it poor behavior or a program to not work remotely in an RDP session and even actively avoiding to do so.
Joey
2010-05-03 22:00:52
thanks! However the app in question is a Synergy server. It works as designed except that when in RDP I dont actually need it to work :) . I dont want to be closing windows on other machines :) unknowingly.
murlex
2010-05-04 18:21:42
@murlex: Ah, sorry then :-). I just came across a few applications that refused to work in RDP environments just because they didn't want customers to use them on a Terminal server, so I kinda assumed you wanted to do the same.
Joey
2010-05-04 18:47:18
A:
I suggests you listen to ETW events raised by WMI around the RDP objects, like Win32_SessionDirectorySession, Win32_Terminal, Win32_TSRemoteDesktop and other. There are various articles describing how to wrap MOF queries into ETW sessions:
Remus Rusanu
2010-05-03 22:33:59