Question : TS 2003 Session

Hi Experts,

We have a TS 2003 Server, a member server and have 20 CAL all using Thin Client.  All users are on 8 by 5 M-F actively connected, some Sales People log remotely thru Windows XP RD.

Is there a way I can make a policy or a script or some kind that after 5PM any TS users have session time out e.g. after 30 minutes a TS user is automatically disconnected?

Thanks a lot,

Answer : TS 2003 Session

Hi Jethro2731,

There's nothing immediately available through the usual interfaces you'd use to administer your terminal server that would provide the functionality you require.  However, you will be able to achieve the result you want through WMI scripting and a TS tool called 'logoff.exe'.  'Logoff.exe' will disconnect and clean a session that you specify from the server from the command line.

Here are the steps you'll need to follow to make it happen:

1.  Write a vbscript that uses a WMI to query the TS server for a list of disconnected sessions, and then calls 'logoff.exe' to clean them out..  This sounds harder than it is.  These steps should help:
  a. Download the WM scriptomatic (v2) from Microsoft.
  b. Run it.  From the WMI Class dropdown, select Win32_TerminalServices.  A basic script will appear in the main window.
  c. Change the script so that it queries your server, and only looks for sessions that are disconnected.  Hint... look for the "." piece and replace it with "".
  d. Modify the script so that the values of the disconnected sessions are dropped into an array.  Check www.w3c.com for help with vbscript arrays if you need to.
  e. For each item in the array, call 'logoff.exe' externally to clean the session from the server.
  f.  After testing, save the script to a local drive on the TS server.

2.  Now that we have a method for programatically removing the disconnected sessions, we just need to trigger it at 5pm each day.  Create a scheduled task on your TS server for 5pm each day.  Make the command that runs "cscript.exe ".

I'd probably also include some type of logging info in the script that allows you to see how many sessions were disconnected each day.

That should do it.  Respond if you need more assistance with the script writing part.

Ceejay

Random Solutions  
 
programming4us programming4us