?
Solved

Schedule Reset of Terminal Services Sessions

Posted on 2009-04-10
1
Medium Priority
?
616 Views
Last Modified: 2012-05-06
I run two TS servers on Windows Server 2003 and I seem to have a problem with certain users leaving their TS session open overnight.  Is there a way that I can schedule to reset all TS sessions say at 2:00 AM or something like that?  I considered using the GPO to reset idle TS sessions, but this would also kill an idle session during the day which I do not want to do.

Any suggestions?
0
Comment
Question by:trbbhm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 31

Accepted Solution

by:
Henrik Johansson earned 500 total points
ID: 24121331
Create a batch script (bat or cmd) which loops through the output of qwinsta, quser, 'query user' or 'query session' command and reset the session with logoff or rwinsta command.
Sample below to use queyr session and logoff sessions except of console (wdcon) session.
Use tsdiscon command If you want to disconnect the session.
@echo off
for /F "tokens=3,4,5 skip=1" %%a in ('query session') do (
	if "%%b" == "Active" if not "%%c"=="wdcon" logoff %%a
)

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question