WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Terminal Server

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Detect if Session is Locked

 Keywords: Detect Determine Session Locked Disconnected ?  
 

Question:

How to detect if a session is locked or disconnected?

Answer:

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.


Article ID:   W17605
Filename:   Detect if Session is Locked.txt
File Created: 2014:03:19:09:36:38
Last Updated: 2014:03:19:09:36:38