How to get the IP Address of the Remote Desktop Client?

BlueGene picture BlueGene · Oct 2, 2009 · Viewed 28.6k times · Source

I'm trying to write a script to log the IP address of the Windows client from which the user initiated Remote Desktop to log in to the Windows Server. How to capture the IP address of the client in the Server?

Answer

Dewfy picture Dewfy · Oct 2, 2009

So, you ignore proxy...

  • using environment var: CLIENTNAME in domain you can resolve it back to IP

without domain controller:

  • using WMI script you can get to Event Log, source: Security, look for category Logon/Logoff where username = environment variable USERNAME