Yesterday I was asked to implement a time-out on active citrix sessions. The purpose for the script was to limit the maximum active session time for the user. The HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\ICA-TCP\MaxActiveSession registry key was not flexible enough and I couldn’t find a ready made solution. I decided to develop my own script based on information in the XenApp Management SDK and on CDN. After some time of scripting I found the following script working and flexible enough to meet the demands of the customer. Basically you schedule the command with the following parameter “cscript <filename.wsf> min <time-out in minutes>”
XX minutes before the session if logged off the user is send an message, the XX minutes is defined by the WarnThreshold value in the script. the Message can be customized by editing the strMsg + strTitle value.
The script can be easily adjusted to be used for a flexible Idle Time-out . the only property that has to be adjusted is Session.LogonTime into Session.LastInputTime
All warnings are logged to a logfile which you can set in the script. Make sure the account used for running the script is a XenApp Administrator.
Off course the usage of the script is based on own risk.
Download file here: Active Session Time-out (757)
- Changed calculation logic
- Changed MessageType to SystemModal + Warning
- Initial Release
Leave a Reply