WTSQuerySessionInformation(Server, SessionId, WTSInfoClass)
Returns information about a terminal services session
InfoClass | Returned value |
WTSApplicationName | Unicode string |
WTSClientDirectory | Unicode string |
WTSClientName | Unicode string |
WTSDomainName | Unicode string |
WTSInitialProgram | Unicode string |
WTSOEMId | Unicode string |
WTSUserName | Unicode string |
WTSWinStationName | Unicode string |
WTSWorkingDirectory | Unicode string |
WTSClientProtocolType | Int, one of WTS_PROTOCOL_TYPE_CONSOLE,WTS_PROTOCOL_TYPE_ICA,WTS_PROTOCOL_TYPE_RDP |
WTSClientProductId | Int |
WTSClientBuildNumber | Int |
WTSClientHardwareId | Int |
WTSSessionId | Int |
WTSConnectState | Int, from WTS_CONNECTSTATE_CLASS |
WTSClientDisplay | Dict containing client's display settings |
WTSClientAddress | Dict containing type and value of client's IP address (None if console session) IPV6 addresses may not be returned correctly on Windows versions earlier than Windows Server 2012 (see http://sourceforge.net/p/pywin32/bugs/664/ for details) |