Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Remotely logoff users from terminal server

Posted on 2009-07-08
4
Medium Priority
?
599 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
[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
4 Comments
 
LVL 13

Expert Comment

by:jaynir
ID: 24809984
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
ID: 24811677
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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

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…
Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

610 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