venerdì 27 settembre 2013

Cassia .NET Windows Terminal Services / Remote Desktop Services Library

Ottima libreria per sfruttare alcune funzioni del remote desktop.
https://code.google.com/p/cassia/

Cassia supports the following operations on both local and remote terminal servers:
  • Enumerating terminal sessions and reporting session information including connection state, user name, client name, client display details, client-reported IP address, and client build number (WTSEnumerateSessions, WTSQuerySessionInformation, and friends)
  • Logging off a session (WTSLogoffSession)
  • Disconnecting a session (WTSDisconnectSession)
  • Displaying a message box in a session and getting a response from the user (WTSSendMessage)
  • Enumerating all processes (WTSEnumerateProcesses)
  • Killing a process (WTSTerminateProcess)
  • Shutting down or rebooting the server (WTSShutdownSystem)

L'indirizzo ip del client connesso:

ITerminalServicesManager manager = new TerminalServicesManager();
foreach (ITerminalServicesSession session in manager.GetLocalServer().GetSessions())
{
    IPEndPoint ipEndPoint = session.RemoteEndPoint as IPEndPoint;
    if (ipEndPoint != null)
    {
        Console.WriteLine(ipEndPoint.Address);
    }
}



;-)

Nessun commento: