3.1 LoggedOffSessions

This Knowledge Script collects data about the completed sessions hosted by a Windows Terminal Server.

This Knowledge Script scans all user sessions and makes a note of a user’s name, session ID, and logon time. On subsequent scans, it compares the current user sessions with its notes from previous sessions.

For each user that is no longer logged on, the Knowledge Script returns the user name, the session ID, the logon time, and the current time, which is the time when the Knowledge Script ran and detected that the session has ended. The script also calculates a maximum session duration by subtracting the logon time from the current time. You can set a threshold for the maximum number of sessions that can end in any interval.

The accuracy of the data returned by this Knowledge Script improves depending on how frequently you set it to run:

  • The Knowledge Script cannot detect sessions that start and end between the intervals when it runs. For example, if you schedule the script to run every hour, a session that starts at 10:15 and ends at 10:45 will not be detected by the script when it runs at 10:00 and 11:00.

  • The maximum duration is calculated using the time when the script runs and determining that a previous session is no longer active. If, for example, the script runs at 30-minute intervals and a session ends 1 minute after the script runs, 29 minutes elapse until the next time the script runs, and the maximum duration is 29 minutes longer than the actual session time.

In both cases, the accuracy of the data returned improves substantially when you schedule it to run at every minute.

HINT:One common use of this Knowledge Script is to provide billing information for the use of Windows Terminal Server (WTS) services. Each data point returned by the Knowledge Script represents a complete, billable session. When using the Knowledge Script for this purpose, remember that the accuracy of the “maximum duration” returned by this script depends on how frequently you run the Knowledge Script.

3.1.1 Resource Object

WTS Sessions

3.1.2 Default Schedule

The default interval is Every hour.

3.1.3 Setting Parameter Values

Set the following parameters as needed:

Description

How to Set It

Raise event if number of completed user sessions exceeds the threshold?

Set to y to raise an event if the number of completed user sessions exceeds the threshold you specify. The default is y.

Collect data for completed user sessions?

Set to y to collect data for charts and reports. If set to y, the Knowledge Script returns the user name, the session ID, the logon time, the current time (the time when the Knowledge Script ran and detected that the session ended), and the maximum session duration (the current time minus the logon time). The default is y.

Threshold -- completed user sessions

Specify the maximum number of user sessions that can end in any given interval before an event is raised. The default is 0.

Event severity when number of completed user sessions exceeds the threshold

Set the event severity level, from 1 to 40, to indicate the importance of the event in which the number of completed user sessions exceeds the threshold. The default severity level is 8.