We have 20 Winxp pc's in a corporate domain. We need to make an application preferred as desktop java (or using vbscript inside classic asp, or vb6, or as a batch script) that will show us which of those have active RDP sessions (or better which of those are in use locally or remotely). Serching I found a simiral case in this solved EE question Java Detect Remote Users
. But the accepted answer, for a reason that I couldn't understand, has nothing to do with the core of the question and doesn't solve it because PsLoggedOn has nothing to do with RDP connections/disconnections and still shows the RDP logged on user as active even if terminates the RDP session.
Another option is to check the RDP port 3389 if is in use. It is very simple through Java with Socket and there are many examples in the Web. But this is not what we need cause it doesn't show us if there is a connection to that port but if a port is bounded by an application for use. In this case every time we check the remote pc will responds with True even if there is not an RDP connection.
Continuing we test other Windows command line utilities like "qwinsta" to query the remote pc for sessions (locale or remote). But pc's responds with "access denied". We search and we find that have to change a registry value "AllowRemoreRPC" that we couldn't find anywhere in the registry of the remote pc.
A very good option would be a small application installed and running on each of the 20 pc's that could catch RDP connections and disconnections and update a network database.