Need a batch file

Posted on 2005-04-18
Last Modified: 2013-11-21
I currently have about 25 users that access our terminal server.  Unfortunately I cannot get them to log off properly which bogs down my system.

Can anyone write me a batch file that will log off the user on the terminal server when they are finished.  Basically I'm looking for something that i can have the user click on the desktop that will log them off and close their session.

Question by:tgfo62
    LVL 95

    Expert Comment

    by:Lee W, MVP
    Why not just put an idle time out on their accounts that automatically logs them off?
    LVL 15

    Expert Comment

    Why don't you set a time limit on a disconnected session?  It would disconnect and free the resources after a user has disconnected for X minutes.  You can do with Group Policy for instance:

    "Sets time limit for disconnected sessions - This policy is found under both Computer Configuration\Administrative Templates\Windows Components\Terminal Services\Sessions and User Configuration\Administrative Templates\Windows Components\Terminal Services\Sessions and it can be used in conjunction of the previous policy above to help enhance your Terminal server's performance. By configuring disconnected sessions to time out after a short period of time, you can ensure that resources are released for your server when a Terminal Services user no longer requires them. Note that this setting has no effect on console or Remote Desktop sessions. "

    Author Comment

    because the users can be normally idle for anytime of period however, they forget how to log off properly when they leave the mobile unit- that's my problem
    LVL 13

    Accepted Solution

    Just go to there user account in active directory.  Click on the Sessions Tab.

    Set the "When a session limit is reached or connection is broken" to END Session.

    When they Disconnect it should end there session

    Author Comment

    not exactly what I asked for, but it is working so thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    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.

    Some time ago I was asked to set up a web portal PC to put at our entrance. When customers arrive, they could see a webpage 'promoting' our company. So I tried to set up a windows 7 PC as a kiosk PC.......... I will spare you all the annoyances I…
    Let’s list some of the technologies that enable smooth teleworking. 
    Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
    After creating this article (, I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

    761 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

    14 Experts available now in Live!

    Get 1:1 Help Now