Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing some scripts to make remote connections to a Windows 2003 server a bit more user-friendly, and in doing this I want to see who's logged in already. In Windows, I could use qwinsta.exe to do this, even for remote servers. So it is exposed somehow, but I couldn't find a matching command line tool for Unix.

Lacking such a tool, I could install an ssh server on the machine and call it remotely, parsing the output or write a small service of my own that would expose this via http, if I don't want full-blown ssh access.

Do I have to do this, or is there already a tool for querying terminal services remotely?

share|improve this question
Sounds like something that might be possible to do using WS-Management... – Oskar Duveborn May 19 '10 at 15:03
up vote 1 down vote accepted

If you want a simple command line access to the windows server,
there is freeSSHd for that.

It will allow you to login to the Windows Server using your ssh client and run commands remotely. You can then run qwinsta.exe and use its output.

share|improve this answer

If you can find a suitable means to query Windows WMI from a non-windows host (and there are some available e.g. here's one for Linux), then you can get the current sessions by querying Win32_LogonSessions. The downside to this method is the WMI service needs to be active on your target.

The other (maybe easier) alternative is as you mentioned, use an SSH connection to run the qwinsta command locally, and grab/parse that output.

Them thar folks over at stack overflow are all brainy when it comes to the programmin', they'll probably have additional insights.

share|improve this answer

I'm confused, do you want to see who's logged into the unix machine or who's logged into the windows machine. For Unix, just use who.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.