From: Jim Gregg on
Hello everyone,

Can anyone assist me with a script? I need to have a script run
locally on a server and read the terminal services session
information. I need to be able to see if there are any sessions
connected, and what their status is at that time. If the status is
idle, then I need to see how long the status has been idle for so that
I can track this infromation and take actions on it if need be. I know
that I can use QWINSTA and read the infromation from that command but
it doesn't provide idle time. Does anyone know of a way to get the
information that QWINSTA provides and also to get the idle time for
each idle session?

Just so everyone knows, we have a situation where certain servers are
not disconnecting sessions after they have been idle for some time
even though we have this set through policy. This appears to be
related to a bug with a piece of software we run which replaces the
MSGINA. The end result is that sessions stay connected after being
idle and they are causing low memory conditions and crashes due to
this other piece of software. If I can track the idle sessions via a
script, then we can proactively kill these sessions while we are
trying to resolve this issue. Thank you for any help you can provide.

Jim
From: Jim Gregg on
I just found Win32_ServerSession which I think will cover what I need
to do.

Jim