Solved

Schedule Reset of Terminal Services Sessions

Posted on 2009-04-10
1
609 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
1 Comment
 
LVL 31

Accepted Solution

by:
Henrik Johansson earned 125 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

The HP utility "HP Lights-Out Online Configuration Utility for Windows Server 2003/2008" could be of great use when it comes to remotely configure a HP servers ILO WITHOUT rebooting the server. We would only need to create and run scripts using thi…
Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

929 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now