win32ts.WTSQuerySessionInformation

WTSQuerySessionInformation(Server, SessionId, WTSInfoClass)

Returns information about a terminal services session

Parameters

Server : PyHANDLE

Handle to a terminal server as returned by win32ts::WTSOpenServer

SessionId : int

Terminal services session id as returned by win32ts::WTSEnumerateSessions

WTSInfoClass : int

Type of information requested, from WTS_INFO_CLASS enum

InfoClass Returned value
WTSApplicationNameUnicode string
WTSClientDirectoryUnicode string
WTSClientNameUnicode string
WTSDomainNameUnicode string
WTSInitialProgramUnicode string
WTSOEMIdUnicode string
WTSUserNameUnicode string
WTSWinStationNameUnicode string
WTSWorkingDirectoryUnicode string
WTSClientProtocolTypeInt, one of WTS_PROTOCOL_TYPE_CONSOLE,WTS_PROTOCOL_TYPE_ICA,WTS_PROTOCOL_TYPE_RDP
WTSClientProductIdInt
WTSClientBuildNumberInt
WTSClientHardwareIdInt
WTSSessionIdInt
WTSConnectStateInt, from WTS_CONNECTSTATE_CLASS
WTSClientDisplayDict containing client's display settings
WTSClientAddressDict 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)