ID of the current session
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Hi,
I connect to the server via RDP. Is it possible to get the ID of the current session ?
I connect to the server via RDP. Is it possible to get the ID of the current session ?
www.FiveTechSoft.com
https://fivetechsupport.com/forums/
https://fivetechsupport.com/forums/viewtopic.php?f=3&t=41277
WTSEnumerateProcess populates a WTS_PROCESS_INFO structure with information pertaining to running processes on the specified host. If the hServer parameter is set to WTS_CURRENT_SERVER_HANDLE, this will run against the host which is running the software.
oLocator := CREATEOBJECT( "wbemScripting.SwbemLocator" )
oWMI := oLocator:ConnectServer()
query user [<username> | <sessionname> | <sessionID>] [/server:<servername>]
local PID, SID
local oList, oProc
oList:= oWmi:ExecQuery( "select * from Win32_Process'" )
for each oProc in oList
PID:=oProc:ProcessId
SID:=oProc:SessionId
exit
next