This question tells me how to detect a remote desktop session.
Do anybody know if it's possible to find out from where the remote connection was initialized?
Since it's in windows use netstat to check which machines you are connected to and on which ports and just parse out the address for the one that uses the port that remote desktop uses.