You can use the Terminal Services query command for this.

query session /server:remote_computer_name_here

Note that you will need to set the following registry value on the remote computer:

Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server
Value Name: AllowRemoteRPC
Value: 1
Type: REG_DWORD

You could put the query command in a batch file, so users can just double click it to see who is logged into that computer.

Answer from Patrick Seymour on Stack Exchange
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows-server › administration › windows-commands › query-user
query user | Microsoft Learn
November 1, 2024 - Reference article for the query user command, which displays information about user sessions on a Remote Desktop Session Host server.
🌐
AirDroid
airdroid.com › home › remote support › how to see who is logged into a remote computer? [2025]
How to See Who Is Logged into a Remote Computer? [2025]
April 3, 2025 - Step 3: Once you execute the command, the terminal will show you the name of the user who is currently using the remote computer. You can also use the Get-CimInstance cmdlet in PowerShell to check if someone is using a computer on the network (Equivalent to Get-WmiObject. But starting in PowerShell 3.0, this cmdlet has been superseded by Get-CimInstance.): Get-CimInstance -ClassName Win32_ComputerSystem -ComputerName $computername | Select -ExpandProperty username · Note : If someone logs into that computer via RDP, it will not return anything.
Discussions

Way to see who is logged into servers remotely?
depending on what you are doing on the servers, you may be able to use RSAT or other app admin console tools...and not actually have to remote to the servers that much. you could also have different admin accounts, like $bossAdmin for logging into a server, and $jrAdmin for logging into a server, so that you dont both use "administrator" and keep kicking each other around. that is a better practice in the first place, and i bet you have this problem because you just have one "administrator" account anyway. More on reddit.com
🌐 r/sysadmin
69
23
June 8, 2016
remotely Identifying a logged on user using CMD - Software & Applications - Spiceworks Community
Hi Does anyone know of a command line to identify a logged on user using CMD? I am updating our asset list and I am trying to identify a couple of unknown computers in my organisation that are logged on occasionally by connecting to them using \computername\C$ I can then use the command: wmic ... More on community.spiceworks.com
🌐 community.spiceworks.com
6
November 27, 2013
Use CMD to return the logged in user of a remote computer - Software & Applications - Spiceworks Community
Use this command to determine who is logged into a computer of an already known IP address or Computer name. Works for Windows 7. (others unknown, probably good for win8 and vista) Step 1: Step 1 Open the Required Rule in Windows Firewall You will need to open the Inbound port for “Remote ... More on community.spiceworks.com
🌐 community.spiceworks.com
29
June 17, 2013
determine what user is logged in remotely (command line) - TechRepublic
Windows XP: I’d like to perform an audit on the office by pinging an IP address (known) and resolving it to a hostname (unknown). I am using ping -a xxx.xxx.xxx.xxx Is there another command or parameter I can use that will tell me what user is logged in to a particular hostname/IP address? More on techrepublic.com
🌐 techrepublic.com
April 28, 2009
🌐
MSPoweruser
mspoweruser.com › home › windows › see who is logged into a remote computer: 6 best ways
See Who Is Logged Into a Remote Computer: 6 Best Ways
October 26, 2025 - In place of RemoteComputerName, you need to type the original name of the remote system.PsLoggedOn \RemoteComputerName · Now, the names of the logged-in users of the remote system will appear.
🌐
Spiceworks
community.spiceworks.com › software & applications
remotely Identifying a logged on user using CMD - Software & Applications - Spiceworks Community
November 27, 2013 - I am updating our asset list and I am trying to identify a couple of unknown computers in my organisation that are logged on occasionally by connecting to them using \computername\C$ I can then use the command: wmic ...
Find elsewhere
🌐
AnyViewer
anyviewer.com › how-to articles › how to check users logged in remote desktop [full guide]
How to Check Users Logged in Remote Desktop [Full Guide]
December 13, 2024 - Step 3. Under "Available snap-ins," choose "Remote Desktop Services Manager," then click "Add." Step 4. Within the "Select Computer" dialog box, determine whether you wish to establish a connection with the local computer or another one. If opting for "Another Computer," input the computer name manually or utilize the "Browse" function to locate it. Click "OK." Step 5. In the "Add or Remove Snap-ins" dialog box, click "OK." Now, you can use this command to see who is logged into a remote computer.
🌐
Windows OS Hub
woshub.com › find-current-user-logged-remote-computer
Find the Current User Logged on a Remote Computer | Windows OS Hub
March 15, 2024 - GetCiminstance uses WinRM to connect to remote computers so you have to enable and configure WinRM on them using GPO or the following command: ... If you want to collect information about logged-in users from multiple computers, you can use the following PowerShell function to get usernames. function Get-LoggedUser { [CmdletBinding()] param ( [string[]]$ComputerName ) foreach ($comp in $ComputerName) { $output = @{'Computer' = $comp } $output.UserName = (Get-WmiObject -Class win32_computersystem -ComputerName $comp).UserName [PSCustomObject]$output } }
🌐
Spiceworks
community.spiceworks.com › software & applications
Use CMD to return the logged in user of a remote computer - Software & Applications - Spiceworks Community
June 17, 2013 - Works for Windows 7. (others unknown, ... Alternatively you can open a elevated command prompt and run “Netsh Firewall set service type = RemoteAdmin mode = Enable” (or you can use disa......
🌐
WindowsDigitals
windowsdigitals.com › home › windows 11 › windows 11: check who is logged in remotely or locally
Windows 11: Check Who is Logged in Remotely or Locally
August 20, 2022 - Replace the ComputerName with the actual computer name of the PC you want to check. ... You can also use query user instead of query session. ... Command prompt will then shows details about the user who is currently logged into the remote computer.
🌐
Guiding Tech
guidingtech.com › home › how to find who is currently logged into your windows computer
Find Out Who is Logged Into Your Windows Computer - Guiding Tech
July 15, 2024 - WMIC /NODE:"ComputerName" COMPUTERSYSTEM GET USERNAME · Replace ComputerName with the actual computer name of the system you are querying. Alternatively, you can also replace ComputerName with the IP address of the system.
🌐
DevOps on Windows
devopsonwindows.com › home › articles › 3 ways to remotely view who is logged on
3 Ways to Remotely View Who Is Logged On
September 2, 2014 - Shorten command: gwmi Win32_ComputerSystem -cn | fl username ... I like the query command. thanks! ... You may be prompted for admin-level credentials when querying a remote machine.
🌐
TechRepublic
techrepublic.com › home › topics › software › software › determine what user is logged in remotely (command line)
determine what user is logged in remotely (command line) - TechRepublic
April 28, 2009 - or WMIC /NODE: “workstation_name” COMPUTERSYSTEM GET USERNAME will return the username currently logged into “workstation_name”
🌐
Reddit
reddit.com › r/winsides › command to see current logged on user on remote computer!
r/Winsides on Reddit: Command to see current logged on user on remote computer!
January 15, 2025 - Remote Desktop Services (RDP) is enabled on the remote computer. Press Windows + S and type cmd in the search bar. Right-click on Command Prompt and select Run as administrator. Confirm any User Account Control (UAC) prompts to open the Command ...
🌐
Bradley Schacht
bradleyschacht.com › find-users-logged-into-remote-computer
Find Users Logged Into Remote Computer
May 24, 2024 - Just fire up the command prompt or PowerShell and run this: query session /server:"" query session /server:"KERBEROS-SP" As we see in the screenshot there is one user logged into this computer, the Administrator account.
🌐
Next of Windows
nextofwindows.com › home › how to tell if someone logged into a remote computer
How To Tell If Someone Logged Into A Remote Computer - NEXTOFWINDOWS.COM
August 29, 2020 - Get-CimInstance Win32_ComputerSystem -ComputerName $computername | Select -ExpandProperty username · But the drawback is, it returns nothing if someone logs into that computer via RDP.
🌐
Host IT Smart
hostitsmart.com › manage › knowledgebase › 394 › How-to-Check-Users-Logged-in-Remote-Desktop.html
How to Check Users Logged in Remote Desktop?
June 30, 2025 - Also Read: How to Fix the Incorrect Password Issue on RDP? ➔ Open Command Prompt or PowerShell & execute PsLoggedOn Command. You have to type the following command: Note: Replace ‘RemoteComputerName’ with the name of the remote computer.
🌐
Spiceworks
community.spiceworks.com › programming & development
who is logged on remote pc from which computer - Programming & Development - Spiceworks Community
September 24, 2018 - I have a domain admin account. I want to find out who is logged in to PC1 from which computer/ip ? currently I can only query which username is logged on PC1 but non of command showed from which computer this user is logged in to PC1. So far I have used pstools \\PC1 query user (this only shows username , not computer name from which the user is loggedin) WMIC /NODE: "PC1" COMPUTERSYSTEM GET USERNAME
🌐
ManageEngine
manageengine.com › adaudit plus › how to › how to view logged-on users in windows using cmd, powershell, and task manager
How to view logged-on users in Windows using CMD, PowerShell & Task Manager
Task Manager: Open Task Manager > Users tab to see logged-in users and their status (GUI required). These methods work across Windows Server 2008-2022 and Windows 10/11, providing both console and remote session visibility.