List of Logged on Terminal Server Users

Posted on 2008-11-18
Last Modified: 2013-11-21
Some users are not logging out of their Terminal Server session at home time.
Now, if I log onto the Terminal Server as Admin, and launch Task Manager, I can get a list of uers.
However, I'd rather run this at 8pm. Is there a way to get a report of the logged on users as at 8pm?
Either through some Server 2003 tool, or through
Question by:jdhackett
    LVL 3

    Expert Comment

    If you are having SSh server running on the machine, you can connect to the machine using ssh and run the command "query session" which will give the following details
    SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE.

    Try to automate this
    LVL 17

    Expert Comment

    Create a little batch file..
    with content:

    query session > loggedonuser.log

    This will create a file with the current status of the logged on users in the path that the batch file was launched from.. You can then schedult this and look at it remotely...
    LVL 1

    Author Comment

    Good stuff. Is there a way I could get the date into the file name, so I have a different log per day?
    LVL 17

    Accepted Solution

    Try this..

    set day=%date:~0,2%
    set month=%date:~3,2%
    set year=%date:~6,4%

    set newdate=%day%%month%%year%
    query session > %newdate%.log

    should create a file with the date + ".log"

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Know what services you can and cannot, should and should not combine on your server.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    733 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

    22 Experts available now in Live!

    Get 1:1 Help Now