Solved

Remotely logoff users from terminal server

Posted on 2009-07-08
4
589 Views
Last Modified: 2012-05-07
Hi,

We have several terminal servers, all servers are windows 2003. I want to log off the users remotely from the terminal servers, so that the profiles are cleaning from the terminal servers. I have tried it with the query session command and then the logoff-command from the domain controller. But then I must hit a key to continue. I have also tried logoff /f, but it doesn't work.

Does anyone know the solution???
0
Comment
Question by:kvwestbroek
4 Comments
 
LVL 13

Expert Comment

by:jaynir
Comment Utility
first you have to query the users that are logged on. you can use qwinsta /server:<servername>

this will show you the username and the ID of the session. Once you know the user who's logged in,
you can use logoff command that will log off the user.
type logoff <session ID>/server:<servername>
0
 

Accepted Solution

by:
kvwestbroek earned 0 total points
Comment Utility
Jaynir,

If I use the logoff command I must hit a key to complete this. Here you can find my script:

query session /SERVER:PTSTEST > session.txt
for /f "skip=2 tokens=2," %%i in (session.txt) DO logoff %%i /SERVER:PTSTEST
del session.txt

I will put this script in the task manager and run it at night.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

6 Experts available now in Live!

Get 1:1 Help Now