MachineName for remote machine using Remote Desktop
Asked Answered
T

2

3

I'm writing a C# program where it would be useful to see if someone is running the program via remote desktop and if so, the machine name where the remote desktop is running.

I can get the former using SystemInformation.TerminalServerSession

But is there any way to get the name of the remote machine?

Threesquare answered 28/4, 2011 at 15:36 Comment(1)
I asked the same question - see my answer here... [#8148404 [1]: #8148404Hanafee
B
2

I think the Remote Desktop Services API will do what you want... http://msdn.microsoft.com/en-us/library/aa383468(v=VS.85).aspx

And the following example may help too - http://community.citrix.com/display/xa/How+to+get+client+IP+address+and+client+hostname+using+Terminal+Services+API

Baronage answered 28/4, 2011 at 16:21 Comment(0)
W
2

You can certainly use WTSQuerySessionInformation to get this information, though if you'd prefer not to deal with the P/Invokes, you could also use the Cassia library: new TerminalServicesManager().CurrentSession.ClientName.

Wulfila answered 6/5, 2011 at 1:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.