WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: troncy on March 15, 2014, 11:44:29 AM

Title: How to detect if a session is locked or disconnected ?
Post by: troncy 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
Title: Re: How to detect if a session is locked or disconnected ?
Post by: ChuckC 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.
Title: Re: How to detect if a session is locked or disconnected ?
Post by: troncy on March 19, 2014, 08:07:57 AM
Merci beaucoup.... Thanks a lot.

Best regards
Claude