qwinsta.exe

  • File Path: C:\Windows\system32\qwinsta.exe
  • Description: Query Session Utility

Hashes

Type Hash
MD5 D36DBFEBFDF8580FD6A3945548DC2208
SHA1 FA14C6ED7BF22CD174D95642DC2C58105299BE1D
SHA256 4E4F3651C108BB2D3B660DC1FE492373EAC23BC9D4C79B2D65521D03732797C0
SHA384 45D34BCD2D963AEA47CBB26306D5E9C508D5B054A68F05195432D91579AC898C6BBC50990507EA834AA23295911EC42F
SHA512 8212C130954CBAD274481C9790318D4E23BA1DACEF14B62B4903B002C0C70F81993DD2DAC6CAC755DC0375385F71FB910044EDA9B32D3B07F5CEEAD97CCE715D
SSDEEP 384:leL8dd8Ys5NJheuABDaB7A8c72t/YuLFEi551EydM1cbg1KTmN5hpBGCr/FehqF8:EgddBsjeuYOc2rLLQimWg1Dh5eh8G

Runtime Data

Usage (stdout):

Display information about Remote Desktop Services sessions.

QUERY SESSION [sessionname | username | sessionid]
              [/SERVER:servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER] [/VM]

  sessionname         Identifies the session named sessionname.
  username            Identifies the session with user username.
  sessionid           Identifies the session with ID sessionid.
  /SERVER:servername  The server to be queried (default is current).
  /MODE               Display current line settings.
  /FLOW               Display current flow control settings.
  /CONNECT            Display current connect settings.
  /COUNTER            Display current Remote Desktop Services counters information.
  /VM                 Display information about sessions within virtual machines.


Usage (stderr):

Invalid parameter(s)
Display information about Remote Desktop Services sessions.

QUERY SESSION [sessionname | username | sessionid]
              [/SERVER:servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER] [/VM]

  sessionname         Identifies the session named sessionname.
  username            Identifies the session with user username.
  sessionid           Identifies the session with ID sessionid.
  /SERVER:servername  The server to be queried (default is current).
  /MODE               Display current line settings.
  /FLOW               Display current flow control settings.
  /CONNECT            Display current connect settings.
  /COUNTER            Display current Remote Desktop Services counters information.
  /VM                 Display information about sessions within virtual machines.


Signature

  • Status: Signature verified.
  • Serial: 33000000BCE120FDD27CC8EE930000000000BC
  • Thumbprint: E85459B23C232DB3CB94C7A56D47678F58E8E51E
  • Issuer: CN=Microsoft Windows Production PCA 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
  • Subject: CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US

File Metadata

  • Original Filename: qwinsta.exe.mui
  • Product Name: Microsoft Windows Operating System
  • Company Name: Microsoft Corporation
  • File Version: 10.0.14393.0 (rs1_release.160715-1616)
  • Product Version: 10.0.14393.0
  • Language: English (United States)
  • Legal Copyright: Microsoft Corporation. All rights reserved.

Possible Misuse

The following table contains possible examples of qwinsta.exe being misused. While qwinsta.exe is not inherently malicious, its legitimate functionality can be abused for malicious purposes.

Source Source File Example License
sigma apt_silence_downloader_v3.yml - '\qwinsta.exe' DRL 1.0
sigma proc_creation_win_local_system_owner_account_discovery.yml - '\qwinsta.exe' DRL 1.0
sigma proc_creation_win_multiple_suspicious_cli.yml - qwinsta.exe DRL 1.0
atomic-red-team T1033.md qwinsta.exe /server:#{computer_name} MIT License. © 2018 Red Canary
atomic-red-team T1033.md qwinsta.exe MIT License. © 2018 Red Canary
atomic-red-team T1033.md for /F “tokens=1,2” %i in (‘qwinsta /server:#{computer_name} ^| findstr “Active Disc”’) do @echo %i | find /v “#” | find /v “console” || echo %j > computers.txt MIT License. © 2018 Red Canary
atomic-red-team T1033.md @FOR /F %n in (computers.txt) DO @FOR /F “tokens=1,2” %i in (‘qwinsta /server:%n ^| findstr “Active Disc”’) do @echo %i | find /v “#” | find /v “console” || echo %j > usernames.txt MIT License. © 2018 Red Canary

Additional Info*

*The information below is copied from MicrosoftDocs, which is maintained by Microsoft. Available under CC BY 4.0 license.


qwinsta

Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

Displays information about sessions on a Remote Desktop Session Host server. The list includes information not only about active sessions but also about other sessions that the server runs.

[!NOTE] This command is the same as the query session command. To find out what’s new in the latest version, see What’s New in Remote Desktop Services in Windows Server.

Syntax

qwinsta [<sessionname> | <username> | <sessionID>] [/server:<servername>] [/mode] [/flow] [/connect] [/counter]

Parameters

Parameter Description
<sessionname> Specifies the name of the session that you want to query.
<username> Specifies the name of the user whose sessions you want to query.
<sessionID> Specifies the ID of the session that you want to query.
/server:<servername> Identifies the rd Session Host server to query. The default is the current server.
/mode Displays current line settings.
/flow Displays current flow-control settings.
/connect Displays current connect settings.
/counter Displays current counters information, including the total number of sessions created, disconnected, and reconnected.
/? Displays help at the command prompt.
Remarks
  • A user can always query the session to which the user is currently logged on. To query other sessions, the user must have special access permission.

  • If you don’t specify a session using the <username>, <sessionname>, or sessionID parameters, this query will display information about all active sessions in the system.

  • When qwinsta returns information, a greater than (>) symbol is displayed before the current session. For example:

      C:\>qwinsta
          SESSIONNAME     USERNAME        ID STATE    TYPE    DEVICE
          console         Administrator1  0 active    wdcon
          >rdp-tcp#1      User1           1 active    wdtshare
          rdp-tcp                         2 listen    wdtshare
                                          4 idle
                                          5 idle
    

    Where:

    • SESSIONNAME specifies the name assigned to the session.
    • USERNAME indicates the user name of the user connected to the session.
    • STATE provides information about the current state of the session.
    • TYPE indicates the session type.
    • DEVICE, which isn’t present for the console or network-connected sessions, is the device name assigned to the session.
    • Any sessions in which the initial state is configured as DISABLED won’t show up in the qwinsta list until they’re enabled.

Examples

To display information about all active sessions on server Server2, type:

qwinsta /server:Server2

To display information about active session modeM02, type:

qwinsta modeM02

Additional References


MIT License. Copyright (c) 2020-2021 Strontic.