How to get query command on Windows 10

5,459

Solution 1

Windows 10 Home does not include query.exe. query.exe is part of Windows Remote Desktop Services (previously called Windows Terminal Services). While the core of Remote Desktop is present in Windows 10 Home, and indeed is used to implement fast user switching and Remote Assistance (now called "Quick Assist"), various features of it have been disabled, including the removal of the command line utilities such as query.exe. By contrast, higher Windows 10 editions including Pro do include those command line utilities.

However, since the underlying APIs are still present, the command line utilities do actually work on Windows 10 Home if you copy them from a Windows 10 Pro (or higher) machine.

I have two machines, one runs Windows 10 Pro and the other runs Windows 10 Home. Both running build 2004. I can successfully get query.exe to work on the Windows 10 Home machine by copying these four files from Windows 10 Pro:

  • C:\Windows\System32\query.exe
  • C:\Windows\System32\Query.dll
  • C:\Windows\System32\en-US\Query.dll.mui
  • C:\Windows\System32\en-US\query.exe.mui

You don't need to put them in C:\Windows\System32 on the Win10 Home machine. It is sufficient to put those the query.exe and query.dll files in any directory, and then put the two .mui files in a en-US subdirectory of that directory. (Note that the .mui file path is correct for US English Windows, if you are using another language those files will come from another subdirectory than en-US.)

After doing the above, running query.exe fails with this error: Can't load QUERY commands from the registry (error 1).

To fix that, we need to do the following: reg export "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Utilities\query" query.reg on the Pro machine, and then reg import query.reg on the Home machine. Now, query.exe works.

But all query user does is call quser.exe, so query user is not going to work on Win10 Home because you don't have quser.exe – you can try copying that as well. Actually all query.exe does is delegate to a bunch of other executables: quser.exe, qappsrv.exe, qprocess.exe, qwinsta.exe. For query.exe to work, you need those EXEs, none of which are included in Win10 Home. You might as well just skip query.exe and copy whichever underlying EXEs you actually need.

For example, if you copy C:\Windows\System32\quser.exe and C:\Windows\System32\en-US\quser.exe.mui to Win10 Home, quser.exe works. You just have to make sure quser.exe.mui is in an en-US subdirectory of the directory containing quser.exe. I haven't tried any of the other q commands, but the others can likely be made to work using the same approach.

(Note while this technically works, I don't know whether it complies with Microsoft's licensing agreements. If you are concerned about that topic, do this at your own risk.)

Solution 2

I have had the same problem using a Win10Home. I copied quser.exe from an Win10Pro machine. It works on my Win10Home too!

Solution 3

%windir%\system32\query.exe is not available in Windows 10 Home.

Windows 10 Pro does have it. I just ran a search in my PCs.

Share:
5,459

Related videos on Youtube

Mark Deven
Author by

Mark Deven

Updated on September 18, 2022

Comments

  • Mark Deven
    Mark Deven over 1 year

    I have a Windows 10 computer on which I need to see what users are logged in via an SSH connection (which is the command prompt). I figured I could run query user on the machine, but the query command is not installed. Where can I get it? To clarify, this is a Windows Command prompt command that comes installed on most windows servers. I dont have query.exe and want to get it on my computer...

    • Outdated Computer Tech
      Outdated Computer Tech almost 5 years
      What do you mean by 'Query Command' is not installed. Are you talking about command prompt?
    • Mark Deven
      Mark Deven almost 5 years
      Command prompt and powershell yes. Hence "command" and my "batch" tag.
    • Outdated Computer Tech
      Outdated Computer Tech almost 5 years
      I don't understand. When you press Start+R (Run) then type CMD. What comes up?
    • Vomit IT - Chunky Mess Style
      Vomit IT - Chunky Mess Style almost 5 years
      Hey Mark— From an admin elevated command prompt, run sfc /scannnow, reboot, and then try it again. Let us know the results afterwards.
    • Mark Deven
      Mark Deven almost 5 years
      I'm talking about the command query in the command prompt. Like the command echo or dir. The actual command you would run to query user data
    • Vomit IT - Chunky Mess Style
      Vomit IT - Chunky Mess Style almost 5 years
      Did you try sfc /scannnow from admin elevated command prompt yet?
    • Mark Deven
      Mark Deven over 4 years
      No because it doesnt come with my version of windows, and I was wondering if there is a way to get it.
  • Mark Deven
    Mark Deven almost 5 years
    Right. I know how commands work. The command is not found.
  • mael'
    mael' almost 5 years
    Just making sure you were actually running it from a cmd.exe window and not via run since it would just exit before displaying anything. I recommend going to your %windir%\system32 folder and making sure query.exe is actually there. If it is, you may need to check your environment variables and make sure your Path location is correct on your system; if it's not there is likely a repair/reset needed.
  • Mark Deven
    Mark Deven almost 5 years
    Of course running it from run wouldn't do anything. And no, query.exe is not there, that is my point. I'm wondering where to get the executable for my computer!