Find Users Logged Into Remote Computer

Have you ever wanted to find out if someone is logged into a computer or maybe who is logged into a computer without having to remote in to check? Recently I was working on a project doing some SharePoint work using 3 accounts: Admin/Install, Farm and Service. The work I was doing required a lot of remote desktop switching between those three accounts, across three environments, plus the SQL Servers and SQL Server service account. Rather than opening up Remote Desktop and logging into each server to see what accounts were logged in I figured I would fire up the good ol’ command line and check that way. There are tons of other ways to do this using PowerShell and I’m sure other command line methods, but this one is quick and easy.

Just fire up the command prompt or PowerShell and run this:

query session /server:”<Server Name Here>”
query session /server:”KERBEROS-SP”


As we see in the screenshot there is one user logged into this computer, the Administrator account. If you want to check multiple computers just create a list in notepad and save it as a batch file to run. This clearly won’t work for a large quantity of servers, but it worked great for the 6 servers I needed to check.

Unfortunately if the user does not have the appropriate permissions on the server they will not get an error message. Instead the result will list no sessions.


Bradley Schacht

Bradley Schacht is a Cloud Solution Architect on the state and local government team with Microsoft based in Jacksonville, FL. He has co-authored 3 SQL Server books including "SQL Server 2014 Professional Administration". As a former consultant and trainer, he uses his experience on many parts of the Microsoft BI and data platform to help customers deliver the best possible solutions. Bradley frequently presents at community events around the country. He is a contributor to sites such as and an active member of the Jacksonville SQL Server User Group (JSSUG).

You may also like...

3 Responses

  1. See discussion on this Blog Post 😉

    Peter kriegel
    founder member of the german speaking PowerShell Community

  2. nathaniel says:

    Qwinsta /server:servername to query computer and rwinsta /server:servername (sessionid)

  3. Michael Meierruth says:

    And there is always
    tsdicon sessionid /server:servername

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.