Author Topic: How to detect if a session is locked or disconnected ?  (Read 1862 times)

troncy

  • Newbie
  • *
  • Posts: 13
How to detect if a session is locked or disconnected ?
« on: March 15, 2014, 11:44:29 am »
Bonjour,

The question is in the subject... I cannot see any simple solution to do that.

Thanks in advance and best regards
Claude

ChuckC

  • Full Member
  • ***
  • Posts: 184
Re: How to detect if a session is locked or disconnected ?
« Reply #1 on: March 17, 2014, 05:53:18 am »
Look in the WIL Consolidated Help file at the topic for the Terminal Service extender.

In particular, the topic for the function wtsQuerySessionInfo() will be of interest to you; the function returns an array of strings, and element 1 of the array contains a string value that identifies what state the session is in.

Also, look at the help topic for the function wtsProcIdToSessId(), which has sample code showing how to first get the PID of your script's own process and then using that PID value to get your terminal services session ID value so that you can then query the session for information.

troncy

  • Newbie
  • *
  • Posts: 13
Re: How to detect if a session is locked or disconnected ?
« Reply #2 on: March 19, 2014, 08:07:57 am »
Merci beaucoup.... Thanks a lot.

Best regards
Claude