Identify the name of the PC that connected to the remote Windows desktop

0

Good morning, I have a server with Windows 7 operating system, I have configured for other PCs to connect to the remote desktop. I want to know which PCs are connected, the user's name is not my problem since I got how to do it. An example: From the Server we go to the Manager of Tares -> User Tab, they will notice that there is a column that says "Client's name ", this is the name that I need. Thank you very much

    
asked by Guillermo 06.04.2016 в 17:00
source

2 answers

1

Assuming you are using Terminal Server services and remote desktop, you can check the environment variable CLIENTNAME , to retrieve the name of the client machine, even if some people report it problems with him.

You can get the value with Environment.GetEnvironmentVariable , for example:

var clientName = Environment.GetEnvironmentVariable("CLIENTNAME");

For an API-based method, check the preferred way to get the client's name from the Terminal Server session showing how to use WMI or the API em> Terminal Services to retrieve the name of the client.

It seems that the Cassia library encapsulates the Terminal Server API. You can get the customer's name with:

TerminalServicesManager().CurrentSession.ClientName

Another operating system thread shows how to retrieve the client name of the current session or the client names of all sessions.

    
answered by 07.11.2016 в 19:14
0

I think you can get it using this code

System.Environment.GetEnvironmentVariable("ClientName");
    
answered by 07.04.2016 в 22:49