I have a winservice running in one PC, it connected to server so we can push a command to this winservcice.
One of the command should be : isConnectedRemotly : which should return true if anyone connect to this machine from other machine (remotely), and for which username (the session username it connected to)
How I can do that?
It depends... if you mean "is the calling process is running under a remote session, you could obtain the session id for the process and get info for the session to check if it is a remote session, with something like: