Paul_Halstead
asked on
Extracting Terminal Server Session ID in Delphi
Greetings,
In our Delphi application we currently use a function GetComputerName to extract the name of the pc where the current instance of the app is running. This gets written to a table in the DB along with things like user-ids and times, so as to provide information as to who is logged in to the app and where.
This is fine in a LAN environment, but increasingly clients are using Terminal Services, where GetComputerName always returns the name of the 'Terminal Server' machine so there is no useful information about where users are logged in. Also if a session needs to be reset via TS manager it is not clear which session to target.
Does anyone know of a way for Delphi to find out whether the app is running under Terminal Services, and if so, to extract the TS 'Session ID' (and, if possible, the name of the pc concerned) in Delphi? Explicit, detailed code examples would be great!
Many thanks,
Paul Halstead
In our Delphi application we currently use a function GetComputerName to extract the name of the pc where the current instance of the app is running. This gets written to a table in the DB along with things like user-ids and times, so as to provide information as to who is logged in to the app and where.
This is fine in a LAN environment, but increasingly clients are using Terminal Services, where GetComputerName always returns the name of the 'Terminal Server' machine so there is no useful information about where users are logged in. Also if a session needs to be reset via TS manager it is not clear which session to target.
Does anyone know of a way for Delphi to find out whether the app is running under Terminal Services, and if so, to extract the TS 'Session ID' (and, if possible, the name of the pc concerned) in Delphi? Explicit, detailed code examples would be great!
Many thanks,
Paul Halstead
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here are some of the same drawer, maybe you can use it.
Open in new window