查看 RDP 连接并确定正在使用的 /admin

View RDP connections and identify what one is using /admin

好的,我 运行 陷入了困境...我想找出系统上哪个会话正在使用 /admin 或又名控制台会话。我尝试了查询会话和 qwinsta,但我似乎无法识别此任务。有人对我如何实现这一目标有任何指示或建议吗?

我最终想做的是阻止任何不是 /admin 连接的 rdp 会话。

以下是我通过命令行完成的一些示例。

PS C:\Users\userid> qwinsta
 SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
 services                                    0  Disc
 console                                     1  Conn
 rdp-tcp#0         userid2                   2  Active  rdpwd
>rdp-tcp#1         userid                  3  Active  rdpwd
 rdp-tcp                                 65536  Listen

PS C:\Users\ userid > query session /mode
SESSIONNAME       STATE   DEVICE    TYPE             BAUD  PARITY  DATA  STOP
 services          Disc                                      none             1
 console           Conn                                     none             1
 rdp-tcp#0         Active            rdpwd                  none             1
>rdp-tcp#1         Active            rdpwd                  none             1
 rdp-tcp           Listen                                   none             1

PS C:\Users\ userid > query session /connect
 SESSIONNAME       STATE   DEVICE    TYPE           CONNECT
 services          Disc                             cts
 console           Conn                             cts
 rdp-tcp#0         Active            rdpwd          cts
>rdp-tcp#1         Active            rdpwd          cts
 rdp-tcp           Listen                           cts

PS C:\Users\ userid >

*注意 rdp-tcp#1 当前正在 mstsc 会话中使用 /admin 开关。

*注意“>”表示当前会话我是运行命令为

服务器是否安装了终端服务角色?如果不是,那么您是否使用 /admin 开关并不重要:

Behavior of the /admin switch

You can start the RDC 6.1 client (mstsc.exe) with the /admin switch to remotely administer a Windows Server 2008-based server (with or without Terminal Server installed). However, if you are connecting to remotely administer a Windows Server 2008-based server that does not have the Terminal Server role service installed, you do not have to specify the /admin switch. (In this case, the same connection behavior occurs with or without the /admin switch.) At any point in time, there can be two active remote administration sessions. To start a remote administration session, you must be a member of the Administrators group on the server to which you are connecting.

[Source]